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 449<br />

With these conventions for representing everything as complex numbers,<br />

the SFT coefficient matrix can be rewritten as in Fig. 13-13. The<br />

numbers listed in the matrix are arguments to the W function mentioned<br />

earlier needed to generate the proper complex multiplier. The operations<br />

involved in going from time to frequency and back are the same as before,<br />

except all arithmetic is now complex. In case one has forgotten (or never<br />

knew), the basic arithmetic operations on two complex numbers, A,B and<br />

C,D, are given below:<br />

A,B + C,D = A+C,B+D<br />

A,B C,D = A-D,B-D<br />

A,B X Cp = AC-BD,AD+BC<br />

A,B _ AC+BD<br />

C,D C 2 +D 2 '<br />

The nice thing about the complex form <strong>of</strong> the SFT is that it is completely<br />

symmetrical. There are no special cases for dc or Nyquist components,<br />

and the form <strong>of</strong> the output is exactly the same as the form <strong>of</strong> the input.<br />

The FFT Algorithm<br />

At this point, we are ready to look at the FFT algorithm itself. Actually,<br />

there are many different algorithms, each with an edge over the others<br />

in certain applications. They all, within round<strong>of</strong>f error, give the same result,<br />

however. The one that will be described here is one <strong>of</strong> the most straightforward<br />

and has the desirable property that sines and cosines (the W function)<br />

are used in ascending order. In technical terms, it is a radix 2 FFT using time<br />

decomposition and input bit reversal. Radix 2 means that the record size<br />

must be a power <strong>of</strong> two. Other radices are possible, but two is the most<br />

efficient, particularly in a binary computer.<br />

The first step in the FFT is to completely decompose the input samples,<br />

which means that they are scrambled in bit-reversed order as in Fig. 13-12.<br />

Fortunately, the scrambling can be accomplished without need for a second<br />

array. One simply programs two counters, one normal and one bit-reversed,<br />

and iterates them from 0 to N -1. Whenever the bit-reversed counter is<br />

numerically greater than the normal counter, the corresponding samples are<br />

swapped. This is illustrated in Fig. 13-14 for N= 16, but the procedure<br />

applies for any record size as long as it is a power <strong>of</strong> two. In assembly<br />

language on a microprocessor, on~ could use just one counter and write a<br />

bit-reversal function, which would take a binary number and return its<br />

bit-reversed equivalent.

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

Saved successfully!

Ooh no, something went wrong!