Forums

Fixed Point Resonant Lowpass Filter C code required

Started by Malcolm Haylock July 27, 2003
Hi everyone,

I'm a relatively newbie to DSP and would like to add a resonant lowpass 
filter to a simple sound application. I have a floating point routine to 
do this but am wondering if this is possible in fixed point. I can't 
easily convert my existing floating point routine as this involves some 
very large gain multiplications not possible in the range of the fixed 
point values of the sound data.

Does anyone have an existing Fixed Point design in C or C++ that I can use?

Thanks,
Malcolm Haylock

Malcolm Haylock <smaugNOSPAM@kagi.com> wrote in message news:<bg090q$grg$1@cpca14.uea.ac.uk>...
> Hi everyone, > > I'm a relatively newbie to DSP and would like to add a resonant lowpass > filter to a simple sound application. I have a floating point routine to > do this but am wondering if this is possible in fixed point. I can't > easily convert my existing floating point routine as this involves some > very large gain multiplications not possible in the range of the fixed > point values of the sound data.
listen, for a biquad implementation (which is the simplest resonant anypass filter implementation), there shouldn't be any feedback coefficients that get bigger in magnitude than 2. an arithmetic shift left instruction in your code (with your coefs scaled down by 2) should take care of that. it's unlikely that any of your feedforward coefs will get much larger than 8 or 16 (which means a couple or 3 additional ASLs in your code) unless your resonant LPF has weird or extreme parameters.
> Does anyone have an existing Fixed Point design in C or C++ that I can use?
it's easy to write and not even that much harder if "fraction saving" (a simple noise-shaping done to the quantization error) is used to make it work and sound decent. check out: http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt to get the basics and then look up "fraction saving" and/or "noise shaping" in Google Groups or Google and see what you come up with. one hit you might look at is: http://www.dspguru.com/comp.dsp/tricks/alg/dc_block.htm this might get you where you need to be. r b-j