Forums

IIR bass/treble shelving with fractionals

Started by vrm October 6, 2010
Hi,
I'm pretty new to DSP and I'm trying to implements simple bass/treble
control using RBJ audio filter cookbook.

Even if I understand nothing to the math behind the coef calculation. I did
a simple implementation in C using 32 bit float, it's working great !

What I want to do is to use blackfin fract16 type to do a fixed point
implementation of those filters (I got a BF537 based board).

I tried to scale down my coefs for being in the range [-1,+1] but I achieve
to have only crappy sound as result (loss of dynamics and a lot of
artifacts).

I there something to do in order to get those filter working with fixed
point, more than scaling coefs to the [-1,+1] range ?

Thanks !
Julien


On 10/06/2010 09:23 AM, vrm wrote:
> Hi, > I'm pretty new to DSP and I'm trying to implements simple bass/treble > control using RBJ audio filter cookbook. > > Even if I understand nothing to the math behind the coef calculation. I did > a simple implementation in C using 32 bit float, it's working great ! > > What I want to do is to use blackfin fract16 type to do a fixed point > implementation of those filters (I got a BF537 based board). > > I tried to scale down my coefs for being in the range [-1,+1] but I achieve > to have only crappy sound as result (loss of dynamics and a lot of > artifacts). > > I there something to do in order to get those filter working with fixed > point, more than scaling coefs to the [-1,+1] range ?
You cannot scale the coefficients, because that changes the filter frequency response. You need to either pick a fixed-point representation scheme that includes the coefficient values, or you have to do the coefficient multiplication then shift up (usually by one, because the coefficients shouldn't exceed -2.0 to 2.0), or you have to multiply and add in parallel (i.e. x + 0.9x = 1.9x). -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html
BTW the test code : http://ideone.com/c5o35
>On 10/06/2010 09:23 AM, vrm wrote: >> Hi, >> I'm pretty new to DSP and I'm trying to implements simple bass/treble >> control using RBJ audio filter cookbook. >> >> Even if I understand nothing to the math behind the coef calculation. I
did
>> a simple implementation in C using 32 bit float, it's working great ! >> >> What I want to do is to use blackfin fract16 type to do a fixed point >> implementation of those filters (I got a BF537 based board). >> >> I tried to scale down my coefs for being in the range [-1,+1] but I
achieve
>> to have only crappy sound as result (loss of dynamics and a lot of >> artifacts). >> >> I there something to do in order to get those filter working with fixed >> point, more than scaling coefs to the [-1,+1] range ? > >You cannot scale the coefficients, because that changes the filter >frequency response. > >You need to either pick a fixed-point representation scheme that >includes the coefficient values, or you have to do the coefficient >multiplication then shift up (usually by one, because the coefficients >shouldn't exceed -2.0 to 2.0), or you have to multiply and add in >parallel (i.e. x + 0.9x = 1.9x). >
Thanks Tim, now it's clear in my mind. I'll try that tomorrow. Julien
It's much better now, but it still have some saturation. I'll try to debug
that.
FYI here the code in case it can help someone :
http://ideone.com/rakFx