[sdiy] Looking for cheap lowpass filter algorithm

Eric Brombaugh ebrombaugh at earthlink.net
Wed Aug 16 15:59:00 CEST 2006


Seb Francis wrote:
> I'm looking for a very simple algorithm to achieve the following ...
>
> With a digital delay running at 48kHz sampling rate I want to have the 
> option to double the delay time by discarding half the data (i.e. have 
> a 24kHz sampling rate)
>
> It works fairly well just storing every other input sample, then 
> interpolating between samples to generate the missing output samples.  
> However high frequencies (e.g. 'S' sounds in speech) come out quite 
> distorted.
>
> So I'm looking for a cheap way in software to filter the high 
> frequencies to make the distortion less noticeable.  Any pointers?
Restating: The fact that you're discarding every other input sample is 
causing aliasing right now. You want a half-band filter on the input to 
your delay line to prevent aliasing before you decimate.

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.

Eric



More information about the Synth-diy mailing list