Hi all. I'm struggling to implement my own codes for IIR filter design by analog prototypes. The Butterworth filter works, the Chebyshev type 1 doesn't. The books I have available are Proakis & Manolakis' 3rd edition, Oppenheim & Schafer 1975+1999, Leland B Jackson 1989. Most show, relatively crudely, the main steps in filter design. Only P&M show any examples of Cheb 1 filters in sufficient detail to check that my code runs correctly, but I don't trust the numbers in P&M. The reason is that I found two grave typos in the table of spectral transforms (how to transform a lowpass prototype filter to highpass, bandpass, or bandstop filters). So when I can't reproduce the numbers from the examples and my filter functions don't make sense, I just don't know if my code is wrong or if there are more typos. So, do anyone know of reference filter designs? I.e. the analog coefficients that pop out of a given spec and their discrete-time counterparts? Rune

# IIR filter reference designs

Started by ●June 9, 2005

Posted by ●June 9, 2005

Rune Allnor wrote:> Hi all. > > I'm struggling to implement my own codes for IIR > filter design by analog prototypes. The Butterworth > filter works, the Chebyshev type 1 doesn't....> So, do anyone know of reference filter designs? I.e. the > analog coefficients that pop out of a given spec and > their discrete-time counterparts?There are several ways on how to approximate a given analogue (s domain) transfer function with a digital (z domain) transfer function. rbj's cookbook uses bilinear transform (I think?), available at http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt. Is that useful? Regards, Andor

Posted by ●June 9, 2005

"Andor" <an2or@mailcircuit.com> wrote in message news:1118349254.467837.166700@z14g2000cwz.googlegroups.com...> Rune Allnor wrote: > > Hi all. > > > > I'm struggling to implement my own codes for IIR > > filter design by analog prototypes. The Butterworth > > filter works, the Chebyshev type 1 doesn't. > ... > > So, do anyone know of reference filter designs? I.e. the > > analog coefficients that pop out of a given spec and > > their discrete-time counterparts? > > There are several ways on how to approximate a given analogue (s > domain) transfer function with a digital (z domain) transfer function. > > rbj's cookbook uses bilinear transform (I think?), available at > http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt.Yes, he does use the bilinear transform, as described in the explanatory text. I went through the trouble to try to duplicate one of his equations exactly starting from first principles, and eventually got it to match after some trig substitutions and a whole bunch of algebra. At the end of the cookbook, he gives some hints on the trig identities and procedure necessary to come up with his final forms, which I found invaluable.

Posted by ●June 9, 2005

FWIW, here's an example of using the bilinear transform on an analog filter prototype; rbj uses sin/cos instead of tan, but they give the same results--obviously, you can rearrange the equations in any number of ways (I followed Zolzer's format). http://www.earlevel.com/Digital%20Audio/Bilinear.html In <11ahc7hs1pvibb4@corp.supernews.com> Jon Harris wrote:> "Andor" <an2or@mailcircuit.com> wrote in message > news:1118349254.467837.166700@z14g2000cwz.googlegroups.com... >> Rune Allnor wrote: >> ...rbj's cookbook uses bilinear transform (I think?), available at >> http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt. > > Yes, he does use the bilinear transform, as described in the > explanatory text. I went through the trouble to try to duplicate one > of his equations exactly starting from first principles, and > eventually got it to match after some trig substitutions and a whole > bunch of algebra...

Posted by ●June 10, 2005

in article 20050609173703992-0700@news.linkline.com, Nigel Redmon at earlevel@earlevel.com wrote on 06/09/2005 20:37:> FWIW, here's an example of using the bilinear transform on an analog > filter prototype; rbj uses sin/cos instead of tan, but they give the > same results--obviously, you can rearrange the equations in any number > of ways (I followed Zolzer's format).just FYI, the reason i use the sin() and cos() (unlike Udo) is because, especially in fixed-point math, tan() is not your friend. tan() likes to purport he's your friend, but he'll betray you and stab you in the back. tan() is your adversary. beware of tan(). -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."

Posted by ●June 10, 2005

Hehe--yeah, I always assumed that's why you used sin/cos. I've always had the good fortune of a UI running on a front end that did the calculations in floating point (either pre-calculated at compile time, or done at run-time), whether it be in an imbedded device with a host running a 56k or something like a Pro Tools plug-in with a prime-time cpu either doing the work in fp or passing the coefs to a 56k. (For that matter, I usually try to use something other than a biquad if the filter needs much in the way of realtime control.) In <BECEA0FB.81CE%rbj@audioimagination.com> robert bristow-johnson wrote:> in article 20050609173703992-0700@news.linkline.com, Nigel Redmon at > earlevel@earlevel.com wrote on 06/09/2005 20:37: > >> FWIW, here's an example of using the bilinear transform on an analog >> filter prototype; rbj uses sin/cos instead of tan, but they give the >> same results--obviously, you can rearrange the equations in any >> number of ways (I followed Zolzer's format). > > just FYI, the reason i use the sin() and cos() (unlike Udo) is because, > especially in fixed-point math, tan() is not your friend. tan() likes > to purport he's your friend, but he'll betray you and stab you in the > back. tan() is your adversary. > > beware of tan().

Posted by ●June 10, 2005

Nigel Redmon wrote:> Hehe--yeah, I always assumed that's why you used sin/cos. I've always > had the good fortune of a UI running on a front end that did the > calculations in floating point (either pre-calculated at compile time, > or done at run-time), whether it be in an imbedded device with a host > running a 56k or something like a Pro Tools plug-in with a prime-time > cpu either doing the work in fp or passing the coefs to a 56k. (For that > matter, I usually try to use something other than a biquad if the filter > needs much in the way of realtime control.)Hi Nigel, what do you try to use instead of biquad? Is this method suited for fixed or for floating (or for both)? Regards, Andor

Posted by ●June 10, 2005

Rune Allnor wrote:> Hi all. > > I'm struggling to implement my own codes for IIR > filter design by analog prototypes. The Butterworth > filter works, the Chebyshev type 1 doesn't. > > The books I have available are Proakis & Manolakis' 3rd > edition, Oppenheim & Schafer 1975+1999, Leland B Jackson > 1989. Most show, relatively crudely, the main steps > in filter design. Only P&M show any examples of Cheb 1 > filters in sufficient detail to check that my code > runs correctly, but I don't trust the numbers in P&M. > The reason is that I found two grave typos in the > table of spectral transforms (how to transform a > lowpass prototype filter to highpass, bandpass, or > bandstop filters). > > So when I can't reproduce the numbers from the examples > and my filter functions don't make sense, I just don't > know if my code is wrong or if there are more typos. > > So, do anyone know of reference filter designs? I.e. the > analog coefficients that pop out of a given spec and > their discrete-time counterparts? > > RuneThank, folks, for your suggestions. I'll have to check out the details in RBJ's cookbook. As of yet, I'm happy just to be able to use matlab to find the filter coefficients. And no, the signal processing toolbox is not an option. It will cost me the equivalent of $1200 + VAT, which I have better use for. I prefer to do the implementations myself. Anyway, I did dig up an old book from the archive boxes in the attic above the garage. van Valkenburg's "Analog Filter Design" from 1982 had just the tables I was looking for: Tables 6.1 and 6.2 (page 165) contain the pole locations and filter coefficients for reference Butterworth filters for orders 10 and below, table 8.1 on page 248 contains pole locations for an assorted number of low order Cheb 1 filters, while table 8.2, page 249, contains a comparision between the design procedures for Butterworth and Cheb 1 filters. Just what I needed! Now, if somebody could compute and publish similar reference tables for the bilinear transform and frequency transforms... Rune

Posted by ●June 10, 2005

Hi Andor, One handy filer for audio is the state variable (some comments from my badly neglected site: http://www.earlevel.com/Digital%20Audio/StateVar. html). Independent Fc and Q--single parameter for each, simple computation--simulaneous low, high, notch, and bandpass output. Extremely good at low frequencies with limited coefficient word length ( unlike biquads), and great as a low frequency sine generator. Integer or floating point. The bad news is that the top end for Fc is only about a third of Nyquist--you must oversample if you want more. Also, filters from single-order sections including, all-pole arrangements, simplify the coefficients versus biquads and make calculations and moving coefficients a lot easier. Besides the state- variable, another popular synth filter is the Moog-style filter suggested by Stilson (http://ccrma-www.stanford.edu/~stilti/papers/ moogvcf.pdf); implemetations available at musicdsp.org. In <1118393122.208868.285770@g44g2000cwa.googlegroups.com> Andor wrote:> Nigel Redmon wrote: >> For that matter, I usually try to use something other than a biquad >> if the filter needs much in the way of realtime control. > > Hi Nigel, > > what do you try to use instead of biquad? Is this method suited for > fixed or for floating (or for both)? > > Regards, > Andor

Posted by ●June 10, 2005

Hello Rune, Using a normalized Butterworth filter (cutoff is at 1), the zeroes of the transfer equation (LaPlace form) are on the unit circle. You can grab pairs (taken symmetrically above and below the real axis) of the zeros and form your transfer equation. The full set of zeroes are the 2n roots of 1. For just your filter, pick the ones in the left hand plane (causal). I.e., for 1st order, the 2n roots are 1, and -1. Using the n roots in the left hand plane, we find just -1. So our transfer equation is simply 1/(s--1) or simply 1/(s+1) For 2nd order, the 4 roots are: 0.707+0.707j 0.707-0.707j -0.707+0.707j -0.707-0.707j ( Really the 0.707 is an approx. to sqrt(2)/2 )) The two zeros in the left hand plane are -0.707+707j and -0.707-0.707j Form a quadratic (product of the two conjugate factors) (s - (-0.707+0.707j) )*(s - (0.707-0.707j)) = s^2 + 1.414s + 1 So your 2nd order filter is 1 / ( s^2 + 1.414s + 1) This can be carried out easily for any order. I wrote a little c program years ago that will give you these functions. For Chebyshev, the method is similar, except instead of a unit circle, you now have ponts on an ellipse. The major and minor axes are given by sinh() and cosh() functions of the passband wobble. When I get back to my house, I can find my notes where I have this all worked out. Are you interested in these details? Clay