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.

486 MUSICAL ApPLICATIONS OF MICROPROCESSORS<br />

Note that the expression for finding K or L depends on the ratio <strong>of</strong><br />

cut<strong>of</strong>f frequency to sample frequency. This should have been expected, since<br />

the same string <strong>of</strong> sample values can represent entirely different signal frequencies<br />

if the sample rates are different. Thus, it is customary in digital<br />

filter work to always specify frequency as a fraction <strong>of</strong> the sample rate rather<br />

than in hertz. Amplitude response plots, therefore, have the frequency axis<br />

calibrated from zero (or some lower limit if a log scale) to 0.5.<br />

There is still one undesirable effect in the digital filter. It has a substantial<br />

amount <strong>of</strong> passband gain. In fact, as K is adjusted for lower cut<strong>of</strong>f<br />

frequencies, the gain increases in inverse proportion to K. This is <strong>of</strong> no<br />

immediate concern with the floating-point arithmetic in BASIC but later,<br />

when the filter arithmetic is converted to integers for increased speed, it can<br />

become a real headache. The amount <strong>of</strong> dc gain is easily determined by<br />

noting that for a constant input <strong>of</strong> 1.0 the output will rise until the amount<br />

removed from the accumulator each sample period via leakage is equal to the<br />

amount added via the input. Thus, the dc gain is 11K or 1/(l-L). The best<br />

way to counteract the gain is to multiply the input samples by the inverse, K,<br />

before adding. The final filter statement therefore is:<br />

1000 LET A=A*L+K*I<br />

Note that two multiplications and one addition are required for each<br />

sample processed. By rearranging constants and allowing large numbers in<br />

the accumulator, one <strong>of</strong> the multiplications can be eliminated:<br />

1000 LET O=K*A<br />

1001 LET A=A-O+I<br />

0<br />

-2<br />

-4<br />

-6<br />

-8<br />

-10<br />

-12<br />

-14<br />

-16<br />

_18~<br />

-20<br />

I<br />

0005 0.01 0.02 0.05<br />

FREQUENCY F/Fs<br />

0.1 0.2<br />

DIGITAL<br />

FILTER<br />

I<br />

! II'<br />

0.5<br />

Fig. 14-3. Measured response <strong>of</strong> digital low-pass filter

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

Saved successfully!

Ooh no, something went wrong!