[sdiy] Looking for cheap lowpass filter algorithm

Seb Francis seb at burnit.co.uk
Wed Aug 16 16:27:26 CEST 2006


Thank you everyone for your fast replies.

Antti Huovilainen wrote:
>
> You want a sharp lowpass filter both at the input and at the output 
> (output filter is slightly less critical). Typically a FIR filter is 
> used for this. What this means in practise is at least 2*16 multiplies 
> per sample. If you tell us how cheap is cheap, I could easily design 
> the filters for you.

Ah, 32 multiplies per sample is more expensive that I wanted.  I was 
hoping to have say <=4 multiplies per sample.


Eric Brombaugh wrote:
>
> The simplest (but not necessarily the best) would be to put a 
> first-order linear decimator Y(n/2) = [X(n) + X(n+1)]/2 on the input 
> of the delay line. Better would be to have more than 2 taps in the 
> filter. Since you're doing this on a dsPIC, FIR filters are fairly 
> cheap from a code standpoint, so you could conceivably get fairly nice 
> transition and stop-band with only a few microseconds of extra 
> execution time.

Effectively the cheap way you are describing is just average each pair 
of input samples to create 1 output sample.


Martin Naef wrote:
> Have a look here (it's called "fast downsampling with anti-aliasing):
> http://www.musicdsp.org/archive.php?classid=3#214
>
> It's essentially a gauss-type decimator for /2 downsampling, which 
> should be very simple and efficient to implement on a fixed point DSP as 
> well.
>
>   

This looks slightly better than what Eric described .. if I read the 
code correctly it looks like this is what it does:
Y(n/2) = [X(n-1)/4 + X(n)/2 + X(n+1)/4]

> If you want better (higher order) filtering, check out the examples 
> dealing with sinc interpolation.
>
> On the same page there's also a 5 and 7 tap downsampler (titled "Hiqh 
> quality /2 decimators").
>
>   

I'll see how many spare CPU cycles I have kicking around and pick one :)

Thanks,
Seb





More information about the Synth-diy mailing list