Forums

Amplitude response of a Biquad Filter

Started by Web Surf January 27, 2006
I now added a set of slider controls to one of the 5 Biquad filters in the
cascade.

There are 5 sliders in the set, each directly changing one of the
coefficeints in the Biquad equation. You can interactively see the
frequency response as you change the coefficients of the Biquad filter.


The reason I decided to directly use the coefficients as the "parameters"
of the Parametric equaliser is because my final application is a Guitar
effects processor. I feel that in this application, odd frequency
responses and phase shifts are sometimes welcome.

Also, the user will be able to see the final freq response of the cascade
filters on his screen via my Excel sheet. Hence there is no reason for me
to implement Constant Q or overshoot corrected or bandwidth corrected
filters as many times necessary for Home Electronics.

I can e-mail the sheet to anyone who is interested.

Thanks to all for sharing knowledge !!!


Hello,

  I have implemented a 5-band equalizer in fixed point using the formulae
provided in the Cookbook. I get the desired output when I intend to
boost/cut the higher 4 bands. But, when I am trying to boost the first
band, the output becomes distorted. I noticed that a cut on the first band
works perfectly fine.

 Assumption : Wrong implementation of filter coefficients???? 
       Well, to test this, I first tried using white noise as my input
signal. This gives me a perfect result in terms of the exact change in dB
level. But, when I use an ordinary audio file, I see the before mentioned
problem.

  Any insights to this problem will be helpful.

Thanks,
R K


>in article F_adnRXf18ptgEfeRVn-tg@giganews.com, Web Surf at >websurff@gmail.com wrote on 01/27/2006 08:19: > >> I have a Guitar effects processor. It has an Equaliser ( five band >> Biquad >filter) >> >> This equaliser accepts 5 coefficients >> >> I wish to plot a graph of the amplitude versus frequency of this >> cascaded >filter. I am using Excel. >> >> Can anyone assist with the formula to generate frequency response of a >Biquad >> filter. > >been all worked out: > >http://groups.google.com/group/comp.dsp/browse_frm/ >thread/8c0fa8d396aeb444/a1bc5b63ac56b686 (unwrap line for
URL)
> > >i need to put this into the cookbook. > >-- > >r b-j rbj@audioimagination.com > >"Imagination is more important than knowledge." > > >
Hello,

  I have implemented a 5-band equalizer in fixed point using the formulae
provided in the Cookbook. I get the desired output when I intend to
boost/cut the higher 4 bands. But, when I am trying to boost the first
band, the output becomes distorted. I noticed that a cut on the first band
works perfectly fine.

 Assumption : Wrong implementation of filter coefficients???? 
       Well, to test this, I first tried using white noise as my input
signal. This gives me a perfect result in terms of the exact change in dB
level. But, when I use an ordinary audio file, I see the before mentioned
problem.

  Any insights to this problem will be helpful.

Thanks,
R K


>in article F_adnRXf18ptgEfeRVn-tg@giganews.com, Web Surf at >websurff@gmail.com wrote on 01/27/2006 08:19: > >> I have a Guitar effects processor. It has an Equaliser ( five band >> Biquad >filter) >> >> This equaliser accepts 5 coefficients >> >> I wish to plot a graph of the amplitude versus frequency of this >> cascaded >filter. I am using Excel. >> >> Can anyone assist with the formula to generate frequency response of a >Biquad >> filter. > >been all worked out: > >http://groups.google.com/group/comp.dsp/browse_frm/ >thread/8c0fa8d396aeb444/a1bc5b63ac56b686 (unwrap line for
URL)
> > >i need to put this into the cookbook. > >-- > >r b-j rbj@audioimagination.com > >"Imagination is more important than knowledge." > > >
rkthebad wrote:
> Hello, > > I have implemented a 5-band equalizer in fixed point using the formulae > provided in the Cookbook. I get the desired output when I intend to > boost/cut the higher 4 bands. But, when I am trying to boost the first > band, the output becomes distorted. I noticed that a cut on the first band > works perfectly fine. > > Assumption : Wrong implementation of filter coefficients???? > Well, to test this, I first tried using white noise as my input > signal. This gives me a perfect result in terms of the exact change in dB > level. But, when I use an ordinary audio file, I see the before mentioned > problem. > > Any insights to this problem will be helpful.
It seems that the low end saturates when you boost it. If there's already a lot of bass in the audio file, you don't have much headroom. If white noise distorted, could you tell by listening? Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Jerry Avins <jya@ieee.org> wrote in news:jYmdnUS6N9GRUXHeRVn-qw@rcn.net:

> rkthebad wrote: >> Hello, >> >> I have implemented a 5-band equalizer in fixed point using the >> formulae >> provided in the Cookbook. I get the desired output when I intend to >> boost/cut the higher 4 bands. But, when I am trying to boost the >> first band, the output becomes distorted. I noticed that a cut on the >> first band works perfectly fine. >> >> Assumption : Wrong implementation of filter coefficients???? >> Well, to test this, I first tried using white noise as my >> input >> signal. This gives me a perfect result in terms of the exact change >> in dB level. But, when I use an ordinary audio file, I see the before >> mentioned problem. >> >> Any insights to this problem will be helpful. > > It seems that the low end saturates when you boost it. If there's > already a lot of bass in the audio file, you don't have much headroom. > > If white noise distorted, could you tell by listening? > > Jerry
Another possible problem could be related to your implementation of the filter. A high Q filter with at a low center frequency relative to the sampling rate may have problems in a typical DF II (direct form) implementation. You mentioned fix point, how many bits? A DF I (possibly with first order error shaping) might be a solution. -- Al Clark Danville Signal Processing, Inc. -------------------------------------------------------------------- Purveyors of Fine DSP Hardware and other Cool Stuff Available at http://www.danvillesignal.com
>rkthebad wrote: >> Hello, >> >> I have implemented a 5-band equalizer in fixed point using the
formulae
>> provided in the Cookbook. I get the desired output when I intend to >> boost/cut the higher 4 bands. But, when I am trying to boost the first >> band, the output becomes distorted. I noticed that a cut on the first
band
>> works perfectly fine. >> >> Assumption : Wrong implementation of filter coefficients???? >> Well, to test this, I first tried using white noise as my input >> signal. This gives me a perfect result in terms of the exact change in
dB
>> level. But, when I use an ordinary audio file, I see the before
mentioned
>> problem. >> >> Any insights to this problem will be helpful. > >It seems that the low end saturates when you boost it. If there's >already a lot of bass in the audio file, you don't have much headroom. > >If white noise distorted, could you tell by listening? > >Jerry >-- >Engineering is the art of making what you want from things you can get. >&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095; >
I am not able to listen to white noise and differentiate the results. I assumed that looking at the spectrum would give me a better idea and hence did the same. Is there any other sanity check that I can perform? ~ R K
>Jerry Avins <jya@ieee.org> wrote in news:jYmdnUS6N9GRUXHeRVn-qw@rcn.net: > >> rkthebad wrote: >>> Hello, >>> >>> I have implemented a 5-band equalizer in fixed point using the >>> formulae >>> provided in the Cookbook. I get the desired output when I intend to >>> boost/cut the higher 4 bands. But, when I am trying to boost the >>> first band, the output becomes distorted. I noticed that a cut on the >>> first band works perfectly fine. >>> >>> Assumption : Wrong implementation of filter coefficients???? >>> Well, to test this, I first tried using white noise as my >>> input >>> signal. This gives me a perfect result in terms of the exact change >>> in dB level. But, when I use an ordinary audio file, I see the before >>> mentioned problem. >>> >>> Any insights to this problem will be helpful. >> >> It seems that the low end saturates when you boost it. If there's >> already a lot of bass in the audio file, you don't have much headroom. >> >> If white noise distorted, could you tell by listening? >> >> Jerry > >Another possible problem could be related to your implementation of the >filter. A high Q filter with at a low center frequency relative to the >sampling rate may have problems in a typical DF II (direct form) >implementation. You mentioned fix point, how many bits? > >A DF I (possibly with first order error shaping) might be a solution. > >-- >Al Clark >Danville Signal Processing, Inc. >-------------------------------------------------------------------- >Purveyors of Fine DSP Hardware and other Cool Stuff >Available at http://www.danvillesignal.com >
I am using a 16-bit fixed point implementation. I have my filter routine setup in a direct form II configuration. The following are the specifications that I am using presently: 5-bands with center frequencies : 100 Hz, 300 Hz, 1 kHz, 3 kHz and 10 kHz. I could have used the 2-Octave frequencies but even there the first band is at a very low freq. (63 Hz). Quality Factor = 4 Sampling frequencies ranging from 8 kHz to 48 kHz (audio related sampling frequencies). And the white noise that I am using to test the system right now is at a sampling freq. of 8 kHz. ~ R K
"rkthebad" <raviyenduri@gmail.com> wrote in
news:gtKdnSB967nLbXHenZ2dnUVZ_sWdnZ2d@giganews.com: 

>>Jerry Avins <jya@ieee.org> wrote in >>news:jYmdnUS6N9GRUXHeRVn-qw@rcn.net: >> >>> rkthebad wrote: >>>> Hello, >>>> >>>> I have implemented a 5-band equalizer in fixed point using the >>>> formulae >>>> provided in the Cookbook. I get the desired output when I intend to >>>> boost/cut the higher 4 bands. But, when I am trying to boost the >>>> first band, the output becomes distorted. I noticed that a cut on >>>> the first band works perfectly fine. >>>> >>>> Assumption : Wrong implementation of filter coefficients???? >>>> Well, to test this, I first tried using white noise as my >>>> input >>>> signal. This gives me a perfect result in terms of the exact change >>>> in dB level. But, when I use an ordinary audio file, I see the >>>> before mentioned problem. >>>> >>>> Any insights to this problem will be helpful. >>> >>> It seems that the low end saturates when you boost it. If there's >>> already a lot of bass in the audio file, you don't have much >>> headroom. >>> >>> If white noise distorted, could you tell by listening? >>> >>> Jerry >> >>Another possible problem could be related to your implementation of >>the filter. A high Q filter with at a low center frequency relative to >>the sampling rate may have problems in a typical DF II (direct form) >>implementation. You mentioned fix point, how many bits? >> >>A DF I (possibly with first order error shaping) might be a solution. >> >>-- >>Al Clark >>Danville Signal Processing, Inc. >>-------------------------------------------------------------------- >>Purveyors of Fine DSP Hardware and other Cool Stuff >>Available at http://www.danvillesignal.com >> > > I am using a 16-bit fixed point implementation. > > I have my filter routine setup in a direct form II configuration. > > The following are the specifications that I am using presently: > 5-bands with center frequencies : 100 Hz, 300 Hz, 1 kHz, 3 kHz and 10 > kHz. I could have used the 2-Octave frequencies but even there the > first band is at a very low freq. (63 Hz). > Quality Factor = 4 > Sampling frequencies ranging from 8 kHz to 48 kHz (audio related > sampling frequencies). > > And the white noise that I am using to test the system right now is at > a sampling freq. of 8 kHz. > > ~ R K >
Try testing the same signals with 8k sampling. Recalculate your coefficients so that you are still looking at 100 Hz CF with the same boost. The basic idea is to create what you think is an identical filter from the point of view of the low frequencies. If the results improve, it would suggest that precision & implementation are likely problems. If the overload is at the same point, it would suggest that you just have too much low frequency content in the input that you are trying to boost. 16 bit precision is generally not enough for high quality audio. This was a major reason why Motorola (now Freescale) was once king in the professional audio space. Their 56K family were 24 bit fixed point when most everything else was 16 bit. In todays world, the SHARC is dominant in this space due largely to its 32 bit fixed and floating point capability. You can use a 16 bit DSP for high quality audio. Its a bit more complicated and slower since you need to do double precision math to create 32 bits. If the DSP is fast enough, the extra computational steps may be acceptable. -- Al Clark Danville Signal Processing, Inc. -------------------------------------------------------------------- Purveyors of Fine DSP Hardware and other Cool Stuff Available at http://www.danvillesignal.com
>Jerry Avins <jya@ieee.org> wrote in news:jYmdnUS6N9GRUXHeRVn-qw@rcn.net: > >> rkthebad wrote: >>> Hello, >>> >>> I have implemented a 5-band equalizer in fixed point using the >>> formulae >>> provided in the Cookbook. I get the desired output when I intend to >>> boost/cut the higher 4 bands. But, when I am trying to boost the >>> first band, the output becomes distorted. I noticed that a cut on the >>> first band works perfectly fine. >>> >>> Assumption : Wrong implementation of filter coefficients???? >>> Well, to test this, I first tried using white noise as my >>> input >>> signal. This gives me a perfect result in terms of the exact change >>> in dB level. But, when I use an ordinary audio file, I see the before >>> mentioned problem. >>> >>> Any insights to this problem will be helpful. >> >> It seems that the low end saturates when you boost it. If there's >> already a lot of bass in the audio file, you don't have much headroom. >> >> If white noise distorted, could you tell by listening? >> >> Jerry > >Another possible problem could be related to your implementation of the >filter. A high Q filter with at a low center frequency relative to the >sampling rate may have problems in a typical DF II (direct form) >implementation. You mentioned fix point, how many bits? > >A DF I (possibly with first order error shaping) might be a solution. > >-- >Al Clark >Danville Signal Processing, Inc. >-------------------------------------------------------------------- >Purveyors of Fine DSP Hardware and other Cool Stuff >Available at http://www.danvillesignal.com >
Clark, I did not notice this earlier, but you suggested me to use a DF I structure. But, isn't this more prone to quantization errors?? Meanwhile, I shall even consider a DF I structure. ~ R K
in article gtKdnSB967nLbXHenZ2dnUVZ_sWdnZ2d@giganews.com, rkthebad at
raviyenduri@gmail.com wrote on 02/10/2006 14:58:
> > I am using a 16-bit fixed point implementation.
oooooooh. <shudder>. you will have real problems with the coefficients for the low band because they will be very close to 1. possibly so close that the difference between 1 and your 16 bit representation is less than an LSB. you might have to tweak the code a little for that and represent your a1/2 and a2 coefficients to be 1 minus their value (possible shifted left a few bits). is not your accumulator a double-wide (32-bits) accumulator?
> I have my filter routine setup in a direct form II configuration.
also, not good. the DF2 is essentially an all-pole filter followed by an all-zero filter. when the poles get real close to the unit circle, the gain gets very high (before any zeros are able to beat the gain down), the intermediate signal (sometimes called "w[n]" or "v[n]", whatever gets multiplied by b0 in the DF2) gets saturated and the information lost or error of that saturation is never recovered, and then the saturated signal goes into the all-zero filter (the numerator coefficients). in article SvadnRQZgaaGY3HeRVn-rw@giganews.com, rkthebad at raviyenduri@gmail.com wrote on 02/10/2006 15:56:
> I did not notice this earlier, but you suggested me to use a DF I > structure. But, isn't this more prone to quantization errors??
not any more than DF1 if your accumulator is double wide.
> Meanwhile, I shall even consider a DF I structure.
yes. that is why it is recommended (and the DF2 is not even mentioned) in the Cookbook. 16 bits, man... tough nut to crack... rots o' ruck. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."