Reply by davidross September 11, 20052005-09-11
Hello again,

Thanks RBJ for the further information relating to the Q of a filter.
Currently I am implementing some 2nd Order IIR Lowpass filters from the
Orfanidis DSP book. However, these filters dont have a 'Q' control, just a
cutoff frequency. Is it possible for every filter to have a 'Q' control
parameter? I would like to add a 'Q' control to my lowpass and highpass
IIR filters but not too sure the exact way to approach it?

My 2nd Order Lowpass transfer function is:

%
%               1 + 2z^-1 + z^-2
%   H(z) = b -----------------------
%             1 - 2az^-1 + a^2z^-2
%

Would it be possible to incorporate 'Q' into this design? I compute b and
a as follows:

% Sampling rate in Hz
Fs = 44100;

% Cutoff frequency in Hz
fCut = 500;

% Cutoff frequency in rads per sample
wc = 2*pi*fCut/44100;

% Apply bilinear transform to angular cutoff
omega = tan(wc/2);

% Compute filter parameter alpha
alpha = omega;

% Compute coefficients in terms of alpha
a = (1 - alpha) / (1 + alpha); 

b = alpha / (1 + alpha);

This is for the 3dB attenuation at the cutoff case. i.e alpha =
tan(wc/2);

Again, would it be possible to add some sort of resonance control to this
design, so that the filter peaks higher at the cutoff frequency?
Thanks very much for any advice.

Cheers,
David
		
This message was sent using the Comp.DSP web interface on
www.DSPRelated.com
Reply by robert bristow-johnson September 8, 20052005-09-08
in article EVNTe.83$QK2.77@trnddc03, Jon Harris at jon99_harris7@hotmail.com
wrote on 09/07/2005 23:07:

> "robert bristow-johnson" <rbj@audioimagination.com> wrote in message > news:1126141185.137440.269720@g44g2000cwa.googlegroups.com... >> >> davidross wrote: >>> >>> Thanks very much for your answers and help. I have used the cookbook >>> before >>> ... they are classics. >> >> there are some hardcore analog audio guys that would take issue with >> that. particularly the way i (mis)define Q or BW for the peakingEQ. > > Is there any standardized way of defining it?
i wouldn't necessarily call it "standard", but the common definition of Q for a peakingEQ that is *boosting* ("dBgain > 0) is to express it as a BPF in parallel with a "wire", and the Q of the BPF is the Q of the EQ. for the case of cutting, if you don't modify the definition of Q, your cut of N dB will not match a boost of N dB with the same Q. so they modify the definition of Q for cutting so that it is a mirror image of the boost with the same Q. in any case for analog EQs, the bandwidth in octaves and the Q are related as 1/Q = 2*sinh(ln(2)/2*BW) for a digital EQ, i think a better relationship would be 1/Q = 2*sinh(ln(2)/2*BW*w0/sin(w0)) where w0 = 2*pi*f0/Fs because of frequency warping. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Reply by davidross September 8, 20052005-09-08
Thanks, I'll look into that..

David

>there's a nice formula for the >Q for each section for an Nth order Butterworth (and they all have the >same w0. for Chebyshev, there are different w0 and Q for each section. > >i don't have the math handy. maybe someone else does. > >-- > >r b-j rbj@audioimagination.com > >"Imagination is more important than knowledge." > >
This message was sent using the Comp.DSP web interface on www.DSPRelated.com
Reply by Jon Harris September 8, 20052005-09-08
"robert bristow-johnson" <rbj@audioimagination.com> wrote in message 
news:1126141185.137440.269720@g44g2000cwa.googlegroups.com...
> > davidross wrote: >> >> Thanks very much for your answers and help. I have used the cookbook >> before >> ... they are classics. > > there are some hardcore analog audio guys that would take issue with > that. particularly the way i (mis)define Q or BW for the peakingEQ.
Is there any standardized way of defining it?
Reply by robert bristow-johnson September 7, 20052005-09-07
davidross wrote:
> > Thanks very much for your answers and help. I have used the cookbook > before > ... they are classics.
there are some hardcore analog audio guys that would take issue with that. particularly the way i (mis)define Q or BW for the peakingEQ.
> I had considered maybe cascading the > second order sections from the cookbook to get a better response i.e. > sharper transition.
> RBJ also mentioned that I could find a good reference on Butterworth or > Chebshev but still use the Cookbook second order sections? Do you mean I > could use the structure of the second order IIR routine i.e. the time > domain implementation, or that I could use for example (for HP)... > > b0 = (1 + cos(w0))/2 > b1 = -(1 + cos(w0)) > b2 = (1 + cos(w0))/2 > a0 = 1 + alpha > a1 = -2*cos(w0) > a2 = 1 - alpha > > ..and use a Butterworth or Chebyshev design to compute the 'alpha' > value?
yes. particularly for the Butterworth. there's a nice formula for the Q for each section for an Nth order Butterworth (and they all have the same w0. for Chebyshev, there are different w0 and Q for each section. i don't have the math handy. maybe someone else does. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Reply by davidross September 7, 20052005-09-07
Hi folks,

Thanks very much for your answers and help. I have used the cookbook
before and implemented some filters using the algorithms straight from the
cookbook. Yep, they are classics. I had considered maybe cascading the
second order sections from the cookbook to get a better response i.e.
sharper transition. Someone mentioned that sharp transitions are not
recommended for 3 Band Equalizers. Is that because the EQ could then sound
to 'harsh' i.e it is nicer to have a smoother sounding rolloff?

RBJ also mentioned that I could find a good reference on Butterworth or
Chebshev but still use the Cookbook second order sections? Do you mean I
could use the structure of the second order IIR routine i.e. the time
domain implementation, or that I could use for example (for HP)...

 b0 =  (1 + cos(w0))/2
 b1 = -(1 + cos(w0))
 b2 =  (1 + cos(w0))/2
 a0 =   1 + alpha
 a1 =  -2*cos(w0)
 a2 =   1 - alpha

..and use a Butterworth or Chebyshev design to compute the 'alpha'
value?

Thanks once again for your help. Its great to be in the presence of such
Filter Gods!

Cheers,
David



		
This message was sent using the Comp.DSP web interface on
www.DSPRelated.com
Reply by Jon Harris September 7, 20052005-09-07
"Jerry Avins" <jya@ieee.org> wrote in message 
news:FOKdnX64RMJGj4PeRVn-3A@rcn.net...
> robert bristow-johnson wrote: >> in article ebOdnZ2dnZ2vvMb2nZ2dnUwlgN6dnZ2dRVn-zp2dnZ0@rcn.net, Jerry Avins >> at jya@ieee.org wrote on 09/06/2005 11:42: >> >> >>>davidross wrote: >>> >>>>Hi Folks, >>>> >>>>This is my first post on the list. Pleased to meet you all :-) This seems >>>>to be an excellent resource of DSP knowledge and I look forward to >>>>learning a lot. >>>> >>>>My first question is with regards to IIR filters. I am looking to design >>>>some IIR filters for audio (Low pass, band pass, and high pass). I know >>>>there are several design approaches available and several structures but i >>>>am interested to know if anyone could recommend a good design approach to >>>>use. I mean, I know they are all good, if not great, but are there any >>>>which are better suited to audio than others? I'm looking for a nice sharp >>>>transition band and good stopband attenuation. Ideally I would like to make >>>>a 3 Band Equalizer which has gain control over each band. >>>> >>>>Thanks for any tips! >>> >>>http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt should provide what >>>you want. A three-band equalizer can be built with two filters and a >>>gain control. >> >> >> second order might not be good enough for David -> "... nice sharp >> transition band and good stopband attenuation." if he finds some nice >> concise information on higher order Butterworth or Tchebyshev, he can still >> use the cookbook for each 2nd order section. dunno. > > I read that but overlooked it. A "nice sharp transition band" is a poor choice > for most audio program material. Granted, there are exceptions.
If the OP wants to emulate traditional analog equalizers, then a second order IIR is the way to go. In a 3-band implementation, the center band is almost always a "peaking" filter (see the cookbook for definition). The top and bottom bands may either be high shelf and low shelf respectively, or also be peaking filters. I'm not sure which is more common in the analog world.
Reply by Jerry Avins September 6, 20052005-09-06
robert bristow-johnson wrote:
> in article ebOdnZ2dnZ2vvMb2nZ2dnUwlgN6dnZ2dRVn-zp2dnZ0@rcn.net, Jerry Avins > at jya@ieee.org wrote on 09/06/2005 11:42: > > >>davidross wrote: >> >>>Hi Folks, >>> >>>This is my first post on the list. Pleased to meet you all :-) This seems >>>to be an excellent resource of DSP knowledge and I look forward to >>>learning a lot. >>> >>>My first question is with regards to IIR filters. I am looking to design >>>some IIR filters for audio (Low pass, band pass, and high pass). I know >>>there are several design approaches available and several structures but i >>>am interested to know if anyone could recommend a good design approach to >>>use. I mean, I know they are all good, if not great, but are there any >>>which are better suited to audio than others? I'm looking for a nice sharp >>>transition band and good stopband attenuation. Ideally I would like to make >>>a 3 Band Equalizer which has gain control over each band. >>> >>>Thanks for any tips! >> >>http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt should provide what >>you want. A three-band equalizer can be built with two filters and a >>gain control. > > > second order might not be good enough for David -> "... nice sharp > transition band and good stopband attenuation." if he finds some nice > concise information on higher order Butterworth or Tchebyshev, he can still > use the cookbook for each 2nd order section. dunno.
I read that but overlooked it. A "nice sharp transition band" is a poor choice for most audio program material. Granted, there are exceptions. Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Reply by robert bristow-johnson September 6, 20052005-09-06
in article ebOdnZ2dnZ2vvMb2nZ2dnUwlgN6dnZ2dRVn-zp2dnZ0@rcn.net, Jerry Avins
at jya@ieee.org wrote on 09/06/2005 11:42:

> davidross wrote: >> Hi Folks, >> >> This is my first post on the list. Pleased to meet you all :-) This seems >> to be an excellent resource of DSP knowledge and I look forward to >> learning a lot. >> >> My first question is with regards to IIR filters. I am looking to design >> some IIR filters for audio (Low pass, band pass, and high pass). I know >> there are several design approaches available and several structures but i >> am interested to know if anyone could recommend a good design approach to >> use. I mean, I know they are all good, if not great, but are there any >> which are better suited to audio than others? I'm looking for a nice sharp >> transition band and good stopband attenuation. Ideally I would like to make >> a 3 Band Equalizer which has gain control over each band. >> >> Thanks for any tips! > > http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt should provide what > you want. A three-band equalizer can be built with two filters and a > gain control.
second order might not be good enough for David -> "... nice sharp transition band and good stopband attenuation." if he finds some nice concise information on higher order Butterworth or Tchebyshev, he can still use the cookbook for each 2nd order section. dunno. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Reply by Jerry Avins September 6, 20052005-09-06
davidross wrote:
> Hi Folks, > > This is my first post on the list. Pleased to meet you all :-) This seems > to be an excellent resource of DSP knowledge and I look forward to > learning a lot. > > My first question is with regards to IIR filters. I am looking to design > some IIR filters for audio (Low pass, band pass, and high pass). I know > there are several design approaches available and several structures but i > am interested to know if anyone could recommend a good design approach to > use. I mean, I know they are all good, if not great, but are there any > which are better suited to audio than others? I'm looking for a nice sharp > transition band and good stopband attenuation. Ideally I would like to make > a 3 Band Equalizer which has gain control over each band. > > Thanks for any tips!
http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt should provide what you want. A three-band equalizer can be built with two filters and a gain control. Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;