CHIME(1) CHIME(1) NAME chime - generate tubular bell chimes SYNOPSIS chime [-d device] [-i infilename] [-p s] [-v] f[,a[,s[,d]]] ... DESCRIPTION Chime is for generating tubular bell chimes. The program uses a sine lookup table to efficiently generate the modes/overtones of the bells using integer arithmetic, and a simple, (one floating point multiply operation per bell, per sample,) discreet time exponential algorithm to efficiently generate the decay of the modes/overtones. As an example usage: chime 220.00,0.125,0.0 246.94,0.125,0.5 261.63,0.125,1.0 \ 293.66,0.125,1.5 311.13,0.125,2.0 329.63,0.125,2.5 \ 349.23,0.125,3.0 392.00,0.125,3.5 would generate the "blues" A scale, (i.e., starting with A3, spaced around middle C, C4,) with bells spaced a half-second apart. A chime is made up of a sequence of bells. Each bell is specified by comma delimited fields: 1) The first field is mandatory, and is the frequency of the bell. 2) The second field is optional, and is the amplitude of the bell, (between zero and unity.) 3) The third field is optional, and is the start time of the bell, (in seconds, defaulting to zero.) 4) the forth field is optional, and is the stop time of the bell, (in seconds, defaulting to 40 seconds.) From http://www.acoustics.hut.fi/publications/papers/norsig04-wind/: Overtones: Mode 1 2 3 4 5 Tube #1 219.8 590.2 1115.4 1766.2 2513.9 Tube #2 245.8 657.6 1239.2 1955.3 2773.1 Tube #3 293.9 782.4 1465.2 2311.8 3278.8 Tube #4 331.6 875.5 1633.0 2576.5 3654.2 Tube #5 366.1 967.5 1794.2 2831.0 4015.1 Relative amplitude of overtones: Mode 1 2 3 4 5 Gain 0.0787 0.1849 1.0000 0.0136 0.0275 Decay time to -60 dB for each overtone: Mode 1 2 3 4 5 40 7 2 1 0.5 From http://home.fuse.net/engineering/Chimes.htm: Mode 1 2 3 4 5 6 7 1X 2.76X 5.40X 8.93X 13.34X 18.64X X31.87 From http://www.phy.mtu.edu/~suits/notefreqs.html: Frequencies for equal-tempered scale,created using A4 = 440 Hz, Speed of sound = 345 m/s = 1130 ft/s = 770 miles/hr, "Middle C" is C4 Note Frequency (Hz) C0 16.35 C#0/Db0 17.32 D0 18.35 D#0/Eb0 19.45 E0 20.60 F0 21.83 F#0/Gb0 23.12 G0 24.50 G#0/Ab0 25.96 A0 27.50 A#0/Bb0 29.14 B0 30.87 C1 32.70 C#1/Db1 34.65 D1 36.71 D#1/Eb1 38.89 E1 41.20 F1 43.65 F#1/Gb1 46.25 G1 49.00 G#1/Ab1 51.91 A1 55.00 A#1/Bb1 58.27 B1 61.74 C2 65.41 C#2/Db2 69.30 D2 73.42 D#2/Eb2 77.78 E2 82.41 F2 87.31 F#2/Gb2 92.50 G2 98.00 G#2/Ab2 103.83 A2 110.00 A#2/Bb2 116.54 B2 123.47 C3 130.81 C#3/Db3 138.59 D3 146.83 D#3/Eb3 155.56 E3 164.81 F3 174.61 F#3/Gb3 185.00 G3 196.00 G#3/Ab3 207.65 A3 220.00 A#3/Bb3 233.08 B3 246.94 C4 261.63 C#4/Db4 277.18 D4 293.66 D#4/Eb4 311.13 E4 329.63 F4 349.23 F#4/Gb4 369.99 G4 392.00 G#4/Ab4 415.30 A4 440.00 A#4/Bb4 466.16 B4 493.88 C5 523.25 C#5/Db5 554.37 D5 587.33 D#5/Eb5 622.25 E5 659.26 F5 698.46 F#5/Gb5 739.99 G5 783.99 G#5/Ab5 830.61 A5 880.00 A#5/Bb5 932.33 B5 987.77 C6 1046.50 C#6/Db6 1108.73 D6 1174.66 D#6/Eb6 1244.51 E6 1318.51 F6 1396.91 F#6/Gb6 1479.98 G6 1567.98 G#6/Ab6 1661.22 A6 1760.00 A#6/Bb6 1864.66 B6 1975.53 C7 2093.00 C#7/Db7 2217.46 D7 2349.32 D#7/Eb7 2489.02 E7 2637.02 F7 2793.83 F#7/Gb7 2959.96 G7 3135.96 G#7/Ab7 3322.44 A7 3520.00 A#7/Bb7 3729.31 B7 3951.07 C8 4186.01 C#8/Db8 4434.92 D8 4698.64 D#8/Eb8 4978.03 Analysis: Mode 1 2 3 4 2.685X 5.075X 8.035X 11.437X 2.675X 5.041X 7.954X 11.281X 2.662X 4.985X 7.866X 11.156X 2.640X 4.925X 7.760X 11.020X 2.643X 4.901X 7.733X 10.967X ------- ------- ------- ------- 2.661X 4.985X 7.870X 11.172X 2.661X 4.985X 7.870X 11.172X 2.76X 5.40X 8.93X 13.34X ------- ------- ------- ------- 2.711X 5.193X 8.400X 12.256X 1.916X 3.098X 4.521X Mode 1 Tube #1 219.8, probably 220 = A3 Tube #2 245.8, probably 246.94 = B3 Tube #3 293.9, probably 293.66 = D4 Tube #4 331.6, probably 329.63 = E4 Tube #5 366.1, probably 369.99 = F#4/Gb4, (but could be 349.23 = F4, or 392.00 = G4) Which looks like a "blues" 'A' scale, {A3, B3, C4, D4, D#4, E4, F4, G4} around middle C, (C4,) which is {220.00, 246.94, 261.63, 293.66, 311.13, 329.63, 349.23, 392.00} Hz., respectively. So, the frequency of the bells is assumed to be A3 = 220 Hz., B3 = 246.94 Hz., D4 = 293.66 Hz., E4 = 329.63 Hz., F4 = 349.23 Hz. And, the overtones will be assumed to be the first, second, third, and forth, with a multiplier of 2.711: 1X, (fundamental) 2.711X, (first overtone) 5.422X, (second overtone) 8.133X, (third overtone) 10.844X, (forth overtone) The relative gains of the overtones will assumed to be 0.061, 0.142, 0.766, 0.010, and, 0.021, (which sum to unity, by multiplying each of the above gains by 1 / 1.3047, which is the sum of the gains): 1X, (fundamental, with an amplitude of 0.061) 2.711X, (first overtone, with an amplitude of 0.142) 5.422X, (second overtone, with an amplitude of 0.766) 8.133X, (third overtone, with an amplitude of 0.010) 10.844X, (forth overtone, with an amplitude of 0.021) Exponential decay time to -60 dB, (1 / 1000,) for each overtone, (exponent = ln (1 / 1000) / T): Mode 1 2 3 4 5 -0.173 -0.987 -3.454 -6.908 -13.816 1X, (fundamental, with an amplitude of 0.061, and an exponential decay of -0.173) 40 2.711X, (first overtone, with an amplitude of 0.142, and an exponential decay of -0.987) 7 5.422X, (second overtone, with an amplitude of 0.766, and an exponential decay of -3.454) 2 8.133X, (third overtone, with an amplitude of 0.010, and an exponential decay of -6.908) 1 10.844X, (forth overtone, with an amplitude of 0.021, and an exponential decay of -13.816) 0.5 Or: The frequency, F, of the chimes will be, (the lengths are for brass tubular bells, with ID = 1", OD = 1.125"): A3 = 220 Hz., (about 40.861 inches in length) B3 = 246.94 Hz., (about 38.568 inches in length) D4 = 293.66 Hz., (about 35.367 inches in length) E4 = 329.63 Hz., (about 33.382 inches in length) F4 = 349.23 Hz., (about 32.431 inches in length) Or the equivilent tubular bells would be about 3' long. The overtones for each frequency will be: Mode 1 2 3 4 5 Overtone Frequency 1F 2.711F 5.422F 8.133F 10.844F Amplitude 0.061 0.142 0.766 0.010 0.021 Exponential Decay -0.173 -0.987 -3.454 -6.908 -13.816 The general formula would be: ((double) 32767 * (double) 0.061 * exp ((double) -0.173 * T) * sin (twopi * F * T) + (double) 32767 * (double) 0.142 * exp ((double) -0.987 * T) * sin (twopi * (double) 2.711 * F * T) + (double) 32767 * (double) 0.766 * exp ((double) -3.454 * T) * sin (twopi * (double) 5.422 * F * T) + (double) 32767 * (double) 0.010 * exp ((double) -6.908 * T) * sin (twopi * (double) 8.133 * F * T) + (double) 32767 * (double) 0.021 * exp ((double) -13.816 * T) * sin (twopi * (double) 10.844 * F * T)); where T is a multiple of 1 / 44100, ranging from 0 to 40 * 44100 for 40 seconds of chime tone, with a maximum peak-to-peak value of +/- 32767. which will require a sine lookup table, (see sine_table.h,) and expo- nentiation by multiplication, (from the above table): Decay time to -60 dB for each overtone, (adding the number of samples required to be -60 dB, E^samples = 1 / 1000, E the multiplier; E = exp ((1 / samples) * ln (1 / 1000))): Mode 1 2 3 4 5 seconds 40 7 2 1 0.5 samples 1,764,000 308,700 88,200 44,100 22,050 which gives the following multipliers: Mode Multiplier 1 0.99999608404662485855 2 0.99997762333011851588 3 0.99992168384601997420 4 0.99984337382545992262 5 0.99968677218267839629 OPTIONS -d device sound device, (/dev/dsp). -i infilename Input file name. -p s Check for pending chime every s seconds after last bell, (never). -v Print the version and copyright banner of the program. f[,a[,s[,d]]] Comma bell description(s): f = frequency, a = amplitude, (1.0), s = start time, (0), d = duration time, (40), one bell per argument. AUTHORS ---------------------------------------------------------------------- A license is hereby granted to reproduce this software source code and to create executable versions from this source code for personal, non-commercial use. The copyright notice included with the software must be maintained in all copies produced. THIS PROGRAM IS PROVIDED "AS IS". THE AUTHOR PROVIDES NO WARRANTIES WHATSOEVER, EXPRESSED OR IMPLIED, INCLUDING WARRANTIES OF MERCHANTABILITY, TITLE, OR FITNESS FOR ANY PARTICULAR PURPOSE. THE AUTHOR DOES NOT WARRANT THAT USE OF THIS PROGRAM DOES NOT INFRINGE THE INTELLECTUAL PROPERTY RIGHTS OF ANY THIRD PARTY IN ANY COUNTRY. Copyright (c) 1994-2007, John Conover, All Rights Reserved. Comments and/or bug reports should be addressed to: john@email.johncon.com (John Conover) ---------------------------------------------------------------------- December 18, 2007 CHIME(1)