[sdiy] Digital filtering question

Tom Wiltshire tom at electricdruid.net
Tue Aug 24 14:53:25 CEST 2010


On 24 Aug 2010, at 12:40, Thomas Strathmann wrote:

> On 8/24/10 13:15 , cheater cheater wrote:
>>> It should be the first (two) zero crossing(s) because for a rectangle which
>>> corresponds to a lowpass filter with cutoff frequency f_c in the frequency
>>> domain you get a sinc function whose width (distance from zero crossing in
>>> the fourth quadrant to z.c. in the first quadrant)
>> 
>> OK, I guess what you mean is: the two zero crossings x_1, x_2 such
>> that |x_1| =<  |x_2|<  x_n for any other zero crossings x_n.
> 
> Yes, and in this case we can be more specific and additionally write
> x_1 = -x_2.
> 
> To come back to what hase been said by Richie Burnett about the practical side of digital filtering: Another way to design a digital (lowpass) filter would be to take an analogue filter design and apply the bilinear transform to its transfer function (i.e. substituting (z-1)/(z+1) for the Laplace variable s) and then taking it from there. This yields an IIR filter instead of a FIR filter. An IIR filter has the advantage of needing very few coefficients (i.e. multiplications, additions, and memory) compared to FIR filters which makes them more suitable for resource contrained environments.
> For FIR filter design there's support in Matlab (e.g. the fir1 function) and maybe in free packages like Octave or Scilab, too.

The downside of IIR designs is the greater accuracy requirement. I haven't done much IIR filtering, so I'm not speaking from practical experience (the best basis on which to have an opinion, I reckon), but my researches on the topic all suggest that whereas you might hope to do FIR filtering at 16-bit accuracy and get a decent result (See Seb Francis' 4XD for an example) for IIR, you probably need 24-bit or 32-bit as a minimum. This is because errors can accumulate as a result of the feedback. There may be ways to manage with 16-bit coefficients if you have a larger accumulator (as is the case on the dsPIC, and probably others).

One other thing to mention with IIR filters is that you have to calculate all the coefficients, no matter what. This is different from FIR filters where (for decimation, for example) you may be able to get away with only calculating the ones you need. So there are situations where FIR can be very efficient.

It's a big subject, and there's a lot of judgements to be made about what constitutes "the best solution" for a given problem. I find Richie's posts incredibly useful because he is able to explain it in a way I understand, and because he has the practical experience to be able to make those judgements well. A big thank you to him for that.

Tom




More information about the Synth-diy mailing list