kyma•tweaky . Share . 2-poleFiltersDiscussion

The attached Sound file contains corrected implementations for the classical 2-pole resonant filters: LPF, HPF, BPF, Band-Reject, All-Pass, Peaking (types 1, 2, and 3), LowShelf?, and HighShelf?.

The previous versions widely used by myself and others were derived from an old Motorola App Note. But that App Note was incorrect. Many of the expressions provided by that App Note produce poles in the individual biquad coefficients, meaning that for some values of Q these coefficients blow-up. Elsewhere, and under most circumstances, those incorrect expressions were so close to the correct values that you could not discern any difference.

However, they were still incorrect. These new versions are correct in every detail. You can show the problem between the two quite readily by taking an old version LPF, setting the Q to 0.001, Fc = 1 kHz, Fs = 44.1 kHz, Level = 0 dB, and watch what happens. The output goes through the roof when fed with pink noise. The new versions do not exhibit this instability.

[Most likely, the App Note was correct, but my interpretation of some abiguous equations was incorrect: terms of the form

sin w0/2Q

were present, where w0 = 2*Pi*fc/fs. So, does this expression mean sin(w0/2Q) ? or sin(w0)/(2Q)? Turns out the correct interpretation is the second form. The filter Q in the denominator of the angle term, before taking the sin, gives rise to incorrect poles in the biquad factors. Physically, this is nonsense too.]

The Motorola DSP's are restricted to arithmetic where all values range between +/-1.0. This has implications most notably for these filters in that the Level input parameter should always be restricted to less than 1 (or gain dB < 0). Many of the filters do compute properly when positive dB gain is injected, but you run the risk of saturating overflow when you do this.

The Low Shelf filter appears to handle bass boosting up to around 20 dB or so. The High Shelf filter has problems for all gains above 0 dB. But the solution here is to realize that a low shelf with a boost or cut of G dB, followed by a gain block with -G dB gain, is identical to a high-shelf filter with the opposite cut or boost, -G dB.

So if you need a high-shelf with positive boost, what you need to do is use a complementary low-shelf filter with that much cut. The overall level will be dropped by that cut, leaving the high frequencies at 0 dB relative to input levels. If your signal can manage positive gain afterwards without clipping, then go ahead and insert a positive gain block after the filtering.

-- DavidMcClain - 05 Jan 2006

----- Revision r1.1 - 05 Jan 2006 - 19:42 GMT - DavidMcClain
Copyright © 1999-2014 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding kyma•tweaky? Send feedback.