[sdiy] Looking for cheap lowpass filter algorithm

Magnus Danielson cfmd at bredband.net
Wed Aug 16 16:47:26 CEST 2006


From: Seb Francis <seb at burnit.co.uk>
Subject: Re: [sdiy] Looking for cheap lowpass filter algorithm
Date: Wed, 16 Aug 2006 15:09:17 +0100
Message-ID: <44E3270D.40608 at burnit.co.uk>

> Magnus Danielson wrote:
> > You want to lowpass filter your signal in 48 kHz with a lowpass-filter having
> > the cut-off just below 12 kHz and a fairly steep slope such that above 12 kHz
> > you have an effective stop-band. A FIR filter will do this for you and you can
> > get linear phase very easilly. Then taking every other sample isn't as grave an
> > error as it is now.
> >
> >   
> > If you don't do this, you will have overtones being twisted around 12 kHz down
> > into the audioble spectrum since taking every other sample is the equalent to
> > sampling at 24 kHz giving it the new Nyquist frequency at 12 kHz.
> >
> >   
> 
> Yes, this is exactly what I am hearing.  Any signal which doesn't have 
> content about ~12 kHz sounds just fine regardless of whether I'm running 
> at 48kHz or 24kHz.

Then that means that I am not talking too much bullshit this time. :P

> So is there a cheap way (low CPU cycles) to implement a FIR filter with 
> a 12kHz cutoff?  It seems like there must be quick&dirty hack that will 
> do this for a frequency that is an exact power-of-2 multiple of the 
> sampling rate.

As it has been pointed out, you want a rather step cutoff for this, and no,
there is no big help from a power-of-2 multiple ratio, you already have that
benefit in the simple sampler aspect. Your problem lies in the actual energy
above your new Nyquist frequency.

Please notice that a N-tap FIR filter for a linear phase (which you want for
this application) only needs N/2 number of multiplications since the
coefficients are symmetric around the middle.

> What about just averaging 2 consecutive samples rather than discarding 
> one of them?

You could do that, but it is a very poor form of filtering. You want to
suppress images such that they are below your noise-floor. For 16 bit you want
your suppression to be below -96 dB. From just below 12 kHz to 12 kHz you want
to drop 96 dB and you and to make sure that the stop-band stays below -96 dB
from 12 kHz to 24 kHz. There is your design-problem. If you want 24 bit
performance, the filter requiremens gets an additional 48 dB harder and there
you are, 50% more taps in your FIR filter.

There is no real way to avoid it.

Cheers,
Magnus



More information about the Synth-diy mailing list