22.09.2015 Views

of Microprocessors

Musical-Applications-of-Microprocessors-2ed-Chamberlin-H-1987

Musical-Applications-of-Microprocessors-2ed-Chamberlin-H-1987

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

440 MUSICAL ApPLICATIONS OF MICROPROCESSORS<br />

will be exactly twice the number <strong>of</strong> harmonics in the input record. The other<br />

modification is for the sine and cosine form <strong>of</strong> the harmonic data. Thus,<br />

when filling a waveform table <strong>of</strong> 256 entries, 128 harmonics must be<br />

specified, although many if not most <strong>of</strong> the higher ones may be zero to avoid<br />

aliasing problems when the table is used for synthesis.<br />

The program segment below.illustrates the inverse slow Fourier transform.<br />

The "C" and "5" arrays hold the cosine and sine harmonic data,<br />

respectively. The de component uses subscript 0, the fundamental uses subscript<br />

1, etc. Thus, the cosine component <strong>of</strong> the eighth harmonic would be<br />

stored in C(8) and the sine component would be in 5(8). During execution,<br />

the time samples will be stored in the T array, which also starts at subscript 0<br />

and is assumed to initially contain zeroes. The constant N is simply the<br />

number <strong>of</strong> samples in the record and should be even.<br />

1000 FOR 1=0 TO N/2-1<br />

1001 FORJ=O TO N-l<br />

1002 LET T0)=T0)+C(I)*COS(6.283l8*I*J/N)<br />

1003 NEXT J<br />

1004 NEXT I<br />

The outer loop steps through the harmonics starting at the zeroth and ending<br />

one short <strong>of</strong> N /2. The inner loop steps through all <strong>of</strong> the time samples for<br />

each harmonic adding the specified cosine and sine components to the current<br />

content <strong>of</strong> the samples.<br />

The "forward" transform, which converts time samples into harmonic<br />

components, however, is what most people have in mind when they speak<br />

about a Fourier transform. Unfortunately, its computation is not intuitively<br />

obvious, although it turns out to be no more complex than the inverse<br />

transform. The basic approach for determining the amplitude <strong>of</strong>a component<br />

with a particular frequency and phase is to generate samples <strong>of</strong> the sought<br />

component, multiply them by corresponding samples <strong>of</strong> the signal to be<br />

analyzed, and then add up the products. The sum, after being divided by<br />

one-half the record size for averaging and mathematical anomalies is the<br />

amplitude <strong>of</strong> the signal component having that frequency and phase! (The de<br />

component will be twice its correct amplitude, however.)<br />

The truth <strong>of</strong> this can be comprehended by remembering that multiplying<br />

two sinusoidal signals is equivalent to balanced modulation and produces<br />

a signal having only sum and difference frequency components. The reader<br />

should also recall that any sinusoidal wave averaged over an integral number<br />

<strong>of</strong> cycles is zero. It is easily seen then if the two signals being multiplied have<br />

different frequencies, that the product consists <strong>of</strong> two sinusoidal waves that,<br />

when averaged over a duration having an integral number <strong>of</strong>periods for'both,<br />

gives zero. If the frequencies being multiplied are the same, the difference<br />

frequency is zero, which is de and results in an average value equal to the<br />

product <strong>of</strong> the signal amplitudes if they are perfectly in phase. When not in

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!