[sdiy] Digital filtering (Oversampling and downsampling)

Eric Brombaugh ebrombaugh1 at cox.net
Mon Aug 3 20:22:38 CEST 2009


Ben Lincoln wrote:
> On Mon, August 3, 2009 9:38 am, Ben Lincoln wrote:
> 
>> Wouldn't you want to take the average (or median, which would be faster to
>> compute) for best results? As opposed to just taking every 8th sample
>> as-is, I mean. Maybe that's what you meant and I misread it.
> 
> Actually, correction, for this specific case it would be faster to compute
> the average of the eight samples, because you could just sum them and then
> bit-shift right by 3. To do the median you'd need to sort the values.
> 
> Back to the original topic, wouldn't this help prevent aliasing, since it
> would be smoothing out the wave and removing harmonic-introducing
> discontinuities? Assuming that's not what Tom's device is doing already,
> of course.

N-sample average, also called a boxcar filter, works but doesn't have an 
ideal frequency response. The impulse response is a sinc function and 
has significant in-band rolloff and lots of flyback at higher 
frequencies. Good for 'hogging out' big stuff, but usually needs some 
equalization for flatness.

And to your second question about how well it helps aliasing - no, it 
doesn't really help much. Aliases are in-band and are created the 
instant you undersample a broadband process. This means that when you 
use a 'naive' algorithm to compute a waveform, the aliases are built-in 
at that point and can't be filtered out.

Aaron Lanterman had a pretty good lecture on this a few years back. 
Worth looking at just for this topic.

Eric



More information about the Synth-diy mailing list