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.

DIGITAL TONE GENERATION TECHNIQUES 455<br />

Innermost in the nest <strong>of</strong> loops is the useful calculation for a pair <strong>of</strong><br />

nodes. The complex numbers that form the node inputs, outputs, and W<br />

function are handled one part at a time according to the rules <strong>of</strong> complex<br />

arithmetic. Note that only the lower argument value (principal value) <strong>of</strong>W is<br />

explicitly evaluated, since the upper argument value gives the same result<br />

with opposite sign. A count <strong>of</strong> useful operations for the node pair gives four<br />

multiplications and six additions. These statements are evaluated (NlogzN)/2<br />

times, which gives a total <strong>of</strong> 2NlogzN multiplications and 3Nlog2N<br />

additions.<br />

So far the FFT has been described in terms <strong>of</strong> transforming a set <strong>of</strong> time<br />

samples into a frequency spectrum. Because <strong>of</strong> the symmetry <strong>of</strong> the W<br />

coefficient array, transforming a spectrum into a sample record requires only a<br />

trivial change in the FFT subroutine. All that is necessary is to place a minus<br />

sign in front <strong>of</strong> N3 in statement 3213. When this is done, the spectrum to be<br />

transformed is stored in the D arrays in the same format that it appears after a<br />

forward transform (be sure to store both the normal and the conjugate<br />

spectrum) and the modified FFT subroutine is called. The time samples will<br />

then appear in the D1 array in natural sequence with the first one at the zero<br />

subscript position. No amplitude adjustment is necessary after the inverse<br />

transform.<br />

Modification for Real Data<br />

As was noted earlier, the complex formulation <strong>of</strong> the FFT tends to be<br />

wasteful when the time samples are real. The multiplication count turns out<br />

to be twice the promised value, which is due to the assumption <strong>of</strong> complex<br />

data and the redundant set <strong>of</strong> computed harmonics. Fortunately, it is possible<br />

to eliminate the wasted storage and redundant spectrum by the addition<br />

<strong>of</strong> a real/complex conversion subroutine.<br />

For the forward FFT, the idea is to store the even-numbered time<br />

samples in the real part <strong>of</strong> the data array and the odd-numbered samples in<br />

the imaginary part, thus doubling the number <strong>of</strong> samples stored. Next, the<br />

FFT is performed as described previously. The spectrum that emerges is no<br />

longer redundant and typically looks like a list <strong>of</strong> random numbers. At this<br />

point, a complex-to-real conversion is performed on the spectrum, which<br />

results in a complete, conventional spectrum <strong>of</strong> N + 1 harmonics for the 2N<br />

data points. For convenience, the Nyquist component is stored as the sine<br />

part <strong>of</strong> the dc component which would otherwise always be zero.<br />

For an inverse FFT, the spectrum is first entered into the data array<br />

normally with no duplication required. Next a real-to-complex conversion is<br />

performed that transforms the set <strong>of</strong> real harmonics into a complex set.<br />

Finally, the inverse FFT is executed to generate a list <strong>of</strong> 2N time sample1:<br />

stored in even-odd order as before.<br />

Figure 13-18 is a diagram <strong>of</strong> the computations involved in the<br />

complex-to-real conversion. First the dc and Nyquist components are both

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

Saved successfully!

Ooh no, something went wrong!