# designing an arbitrary 10 tap IIR filter

Started by June 11, 2004
Hi,
i would like to design a 10 tap IIR butterworth filter with a given
cutoff.  What tools are available to help me realise this in C.

for example for RBJ's biquad filters there are equations on how to
update your coefficients when your cutoff or sr changes. i'm looking to
do something similar but on a higher order filter.

thanks for any suggestions or pointers ...

regards,
sam

sammyd wrote:
> > Hi, > i would like to design a 10 tap IIR butterworth filter with a given > cutoff. What tools are available to help me realise this in C. > > for example for RBJ's biquad filters there are equations on how to > update your coefficients when your cutoff or sr changes. i'm looking to > do something similar but on a higher order filter.
Try this: http://www-users.cs.york.ac.uk/~fisher/mkfilter/ Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo nospam@mega-nerd.com (Yes it's valid) +-----------------------------------------------------------+ A good debugger is no substitute for a good test suite.
sammyd wrote:

> Hi, > i would like to design a 10 tap IIR butterworth filter with a given > cutoff. What tools are available to help me realise this in C. > > for example for RBJ's biquad filters there are equations on how to > update your coefficients when your cutoff or sr changes. i'm looking to > do something similar but on a higher order filter. > > thanks for any suggestions or pointers ... > > regards, > sam >
I hope you mean that you want to implement a 10th order IIR filter, not that you're going to try and implement a 10th order polynomial directly! Direct polynomial implementations get very bad very quickly -- the precision required goes up exponentially with the number of poles, so even if your poles are fairly distant from z = 1.0 you still get into numeric trouble fairly quickly. It's much better to implement your filter as a cascade of 1st- and 2nd-order filters. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
Hi Erik,

did you actually try that page? All I'm getting is an "Error! Command
failed (return code 256)" message no matter what kind of filter I
try... :-(

--smb

Erik de Castro Lopo <nospam@mega-nerd.com> wrote in message news:<40CA801D.96CA499@mega-nerd.com>...
> sammyd wrote: > > > > Hi, > > i would like to design a 10 tap IIR butterworth filter with a given > > cutoff. What tools are available to help me realise this in C. > > > > for example for RBJ's biquad filters there are equations on how to > > update your coefficients when your cutoff or sr changes. i'm looking to > > do something similar but on a higher order filter. > > Try this: > > http://www-users.cs.york.ac.uk/~fisher/mkfilter/ > > Erik
Stephan M. Bernsee wrote:

> Hi Erik, > > did you actually try that page? All I'm getting is an "Error! Command > failed (return code 256)" message no matter what kind of filter I > try... :-( > > --smb
... "You specified the following parameters: filtertype = Butterworth passtype = Lowpass ripple = order = 6 samplerate = 8000 corner1 = 200" worked for me. Could it be a problem with Java on your machine? Jerry -- Engineering is the art of making what you want from things you can get. &#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
Erik de Castro Lopo wrote:

> sammyd wrote: > >>Hi, >>i would like to design a 10 tap IIR butterworth filter with a given >>cutoff. What tools are available to help me realise this in C. >> >>for example for RBJ's biquad filters there are equations on how to >>update your coefficients when your cutoff or sr changes. i'm looking to >>do something similar but on a higher order filter. > > > Try this: > > http://www-users.cs.york.ac.uk/~fisher/mkfilter/ > > Erik
Same comments -- with an IIR you want to be careful about a direct realization because of numerical problems. I would use cascaded 2nd-order filters to avoid this. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
Hi Jerry,

actually, your example works on my machine as well. However, the
bandpass resonator I tried does not (sr=44100, fc=1000, q=10). Maybe
that applet is broken...

Thanks!
--smb

Jerry Avins <jya@ieee.org> wrote in message news:<40cb442a\$0\$2983\$61fed72c@news.rcn.com>...
> Stephan M. Bernsee wrote: > > > Hi Erik, > > > > did you actually try that page? All I'm getting is an "Error! Command > > failed (return code 256)" message no matter what kind of filter I > > try... :-( > > > > --smb > > ... > > "You specified the following parameters: > > filtertype = Butterworth > passtype = Lowpass > ripple = > order = 6 > samplerate = 8000 > corner1 = 200" > > worked for me. Could it be a problem with Java on your machine? > > Jerry
On Sat, 12 Jun 2004 09:35:13 +0000, Tim Wescott wrote:

> sammyd wrote: > >> Hi, >> i would like to design a 10 tap IIR butterworth filter with a given >> cutoff. What tools are available to help me realise this in C. >>
> It's much better to implement your filter as a cascade of 1st- and > 2nd-order filters.
Aggree -- but Not exponentially. It goes up linearly. Have an 8 bit filter that is two stage, and say a precision of 16 bits, then a 3 stage needs 24 and 4 stage needs 32 and so on. |
Robin Clark wrote:

> On Sat, 12 Jun 2004 09:35:13 +0000, Tim Wescott wrote: > > >>sammyd wrote: >> >> >>>Hi, >>>i would like to design a 10 tap IIR butterworth filter with a given >>>cutoff. What tools are available to help me realise this in C. >>> > > >>It's much better to implement your filter as a cascade of 1st- and >>2nd-order filters. > > Aggree
> but Not exponentially. > > It goes up linearly. > Have an 8 bit filter that is two stage, and say a precision of > 16 bits, then a 3 stage needs 24 and 4 stage needs 32 and so on. Linearly in bit count, exponentially in magnitude. -- Engineering is the art of making what you want from things you can get. &#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
On Sun, 13 Jun 2004 09:20:15 +0000, Jerry Avins wrote:

> Robin Clark wrote: > >> On Sat, 12 Jun 2004 09:35:13 +0000, Tim Wescott wrote: >> >> >>>sammyd wrote: >>> >>> >>>>Hi, >>>>i would like to design a 10 tap IIR butterworth filter with a given >>>>cutoff. What tools are available to help me realise this in C. >>>> >> >> >>>It's much better to implement your filter as a cascade of 1st- and >>>2nd-order filters. >> >> Aggree > > > but Not exponentially. > > > > It goes up linearly. > > > Have an 8 bit filter that is two stage, and say a precision of > > 16 bits, then a 3 stage needs 24 and 4 stage needs 32 and so on. > > Linearly in bit count, exponentially in magnitude.
Yup. By by powers of 2.... A well defined exponential... -- [=========] -==++""" . /. . . \ . """++==- -+"" \ .. . . | .. . | . . . / ""+- /\ +-"" `-----=====\ <O> /=====-----' ""-+ /\ / / ""="" \ \ / / \ \ // | \\ /") \ | / ("\ \o\ \*/ /o/ \ ) --**O**-- ( / /*\ / | \ |