DSPRelated.com
Forums

tuning a parametric equalizer

Started by Adam M. February 4, 2005
Hello.

I'm trying to create a multiband parametric equalizer in software, but I'm 
unsure of how to tune the equalizer bands. I've only recently started 
learning DSP, but I've studied the DFT/FFT and basic IIR filters like low 
pass, high pass, and band pass...

My original idea was to use a FFT for the equalizer, but I quickly learned 
that IIR is the way to go. It seems pretty simple to do with an FFT since 
the data's already in the frequency domain, but figuring out the details of 
doing it in the time domain seems complicated.

Using the information contained in this cookbook, I've created the basic 
filters for the equalizer (low/high/band pass, notch, peaking, shelf).
http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt

My implementation of the code to apply the filters to an input stream 
basically matches that described in this program, so I'm pretty sure it's 
correct.
http://www.dspguru.com/sw/lib/biquad.c

First, my assumption is that the way to create a multiband EQ is to use one 
filter for each band, so a 10-band equalizer would have 10 different 
filters. And I'm assuming that I should run the input stream through each 
band's filter in parallel and then mix it all back together. Will this work?

Second, if that's the correct way to go about this, how do you tune the 
parameters for the individual bands (eg, the filter type [bandpass, peaking, 
etc] and the bandwidth [or Q or shelf slope])? Is there any known-good set 
of parameters that would work for a given filter type and frequency 
distribution? I'm using a pretty common setup (10 bands -- doubling from 
31.25hz to 16000hz). I would have thought that the tuning parameters for 
such a setup would be pretty well known, but I haven't been able to find any 
tuning data for any EQ setup at all.

I don't have any special requirements. The EQ should just be a general 
purpose EQ for the audible sound spectrum.

Thanks in advance,
-- Adam 


Adam M. wrote:
...

> First, my assumption is that the way to create a multiband EQ is to use one > filter for each band, so a 10-band equalizer would have 10 different > filters. And I'm assuming that I should run the input stream through each > band's filter in parallel and then mix it all back together. Will this work?
It will work, but I wouldn't do it this way - think of the phase cancellations.
> Second, if that's the correct way to go about this, how do you tune the > parameters for the individual bands (eg, the filter type [bandpass, peaking, > etc] and the bandwidth [or Q or shelf slope])? Is there any known-good set > of parameters that would work for a given filter type and frequency > distribution? I'm using a pretty common setup (10 bands -- doubling from > 31.25hz to 16000hz). I would have thought that the tuning parameters for > such a setup would be pretty well known, but I haven't been able to find any > tuning data for any EQ setup at all.
As an example, you can download the manual for a digital eq here: http://www.weiss.ch/downloads.html Be sure to take the "eq1 mk2" manual. The parameter ranges are listed at the back of the manual (under the section "Technical Data"). Regards, Andor
>> First, my assumption is that the way to create a multiband EQ is to >> use one filter for each band, so a 10-band equalizer would have 10 >> different filters. And I'm assuming that I should run the input >> stream through each band's filter in parallel and then mix it all >> back together. Will this work? > It will work, but I wouldn't do it this way - think of the phase > cancellations.
Unfortunately, I'm new to DSP, so I can't really imagine the phase cancellations or their effects. You said you wouldn't do it that way -- how would you do it?
>> Second, if that's the correct way to go about this, how do you tune the >> parameters for the individual bands (eg, the filter type [bandpass, peaking, >> etc] and the bandwidth [or Q or shelf slope])? Is there any known-good set >> of parameters that would work for a given filter type and frequency >> distribution? I'm using a pretty common setup (10 bands -- doubling from >> 31.25hz to 16000hz). I would have thought that the tuning parameters for >> such a setup would be pretty well known, but I haven't been able to find any >> tuning data for any EQ setup at all. > As an example, you can download the manual for a digital eq here: > > http://www.weiss.ch/downloads.html > > Be sure to take the "eq1 mk2" manual. The parameter ranges are listed at > the back of the manual (under the section "Technical Data").
Thanks for pointing that out. It looks to be just the thing, although there seem to be 120 values for each parameter. Does this mean there are 120 filters? If so, that would be far too computationally intensive for what I'm trying to do... could I just interpolate them into 10 or so?
> Regards, > Andor
Thanks, Adam M.
Adam M. wrote:

  ...

> Unfortunately, I'm new to DSP, so I can't really imagine the phase > cancellations or their effects.
... Digital or analog makes no difference. Suppose one filter reduces the amplitude of a frequency somewhat and retards its phase 90 degrees. Suppose also that the next one in the line reduces the amplitude of the same frequency by the same amount and advances its phase 90 degrees. Add the two filter outputs and POOF!. The frequency is gone, kaput, canceled. ... Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
"Adam M." <adam@adammil.net> wrote in message
news:slrnd07b93.47l.adam@adam.adammil.net...
> >> First, my assumption is that the way to create a multiband EQ is to > >> use one filter for each band, so a 10-band equalizer would have 10 > >> different filters. And I'm assuming that I should run the input > >> stream through each band's filter in parallel and then mix it all > >> back together. Will this work? > > It will work, but I wouldn't do it this way - think of the phase > > cancellations. > Unfortunately, I'm new to DSP, so I can't really imagine the phase > cancellations or their effects. > > You said you wouldn't do it that way -- how would you do it?
Run the filters in series--the output of one filter becomes the input to the next, etc..
> > Hmm.. in series, eh? > > > > To successfully combine them in series, I need to use filters > > that pass frequencies outside their "band" through unchanged, > > right? > > What you want to do is use the peaking EQ from the cookbook, > rather than the bandpass. It works exactly as you've described.
Hi Jon, Thank you for your advice! I changed the EQ from bandpass-in-parallel to peaking-in-series and it appears to be working. Now I'm back to the original problem of tuning it. Are there any guidelines for choosing the Q value for a given frequency spread? (Again, it's a 10-band equalizer doubling from 31.25hz to 16khz.) At first, each band was about the same size and when a constant gain was applied to all of them, they each produced a small spike. But the low-frequency bands were so close together that the spikes overlapped and amplified greatly, and the high-frequency bands were so far apart that there were huge gaps between them. So I tried dividing Q by a value that increased linearly with frequency (so it increased exponentially from one band to the next), and it seemed to help. The low bands didn't have as much overlap and the high bands were wide and without big gaps, but I'm sure it's still poorly tuned.
> BTW, I think what you are trying to do is usually called a > graphic equalizer rather than a parametric equalizer.
Ahh, sorry if I used incorrect terminology. I'm actually trying to create some generalized equalizer code (N bands, configurable filter type, frequency, Q/shape/slope, etc), and this particular 10-band equalizer is an instance of the generalized equalizer. So whatever that's called... ;-) Anyway, thanks again. I'm much closer now! -- Adam
I think you want to choose the bandwidthds to be a consstnat % of the
center freq.  As you go higher in frequency, each filter gets wider,
i.e a constant Q.  This way you have say 4 (or some number of ) filters
per each octave.  The Q and spacing should be choosen so that when you
have all the filters set for unity gain, the overall response is flat
without excesisve ripple.

Mark

You are dead on with the first part there.  However, for unity gain, the overall 
response is going to be perfectly flat no matter what the bandwidth is with the 
peaking filters we have been discussing.

For the width, find the line in the cookbook that says "(case: BW)".  That's 
what you want to use.  Set the bandwidth based on the filter spacing.  For 
example, since your filters are each 1 octave apart, set BW = 1.

"Mark" <makolber@yahoo.com> wrote in message 
news:1107582715.020793.18510@g14g2000cwa.googlegroups.com...
>I think you want to choose the bandwidthds to be a consstnat % of the > center freq. As you go higher in frequency, each filter gets wider, > i.e a constant Q. This way you have say 4 (or some number of ) filters > per each octave. The Q and spacing should be choosen so that when you > have all the filters set for unity gain, the overall response is flat > without excesisve ripple. > > Mark >
Also, I just remembered there is an app note that discusses graphic EQs in 
detail:
http://www.rane.com/note101.html
I think that may address many of your questions.

"Jon Harris" <goldentully@hotmail.com> wrote in message 
news:36j673F52qkqeU1@individual.net...
> You are dead on with the first part there. However, for unity gain, the > overall response is going to be perfectly flat no matter what the bandwidth is > with the peaking filters we have been discussing. > > For the width, find the line in the cookbook that says "(case: BW)". That's > what you want to use. Set the bandwidth based on the filter spacing. For > example, since your filters are each 1 octave apart, set BW = 1. > > "Mark" <makolber@yahoo.com> wrote in message > news:1107582715.020793.18510@g14g2000cwa.googlegroups.com... >>I think you want to choose the bandwidthds to be a consstnat % of the >> center freq. As you go higher in frequency, each filter gets wider, >> i.e a constant Q. This way you have say 4 (or some number of ) filters >> per each octave. The Q and spacing should be choosen so that when you >> have all the filters set for unity gain, the overall response is flat >> without excesisve ripple. >> >> Mark
Jon, Mark,

> Also, I just remembered there is an app note that discusses > graphic EQs in detail: > http://www.rane.com/note101.html > I think that may address many of your questions.
Ahh, thanks. That's a very good and accessible document. It certainly does answer a lot of questions. Like what the definition of "Q", and the goals to strive for in EQ tuning... I was just tweaking by trial-and-error before, but now I can tweak with confidence! ;-)
> > For the width, find the line in the cookbook that says "(case:
BW)".
> > That's what you want to use. Set the bandwidth based on the filter > > spacing. For example, since your filters are each 1 octave apart, > > set BW = 1.
That works very well, thanks.
> > "Mark" <makolber@yahoo.com> wrote: > >> I think you want to choose the bandwidthds to be a consstnat % > >> of the center freq. As you go higher in frequency, each filter > >> gets wider, i.e a constant Q. This way you have say 4 (or some > >> number of ) filters per each octave. The Q and spacing should > >> be choosen so that when you have all the filters set for unity > >> gain, the overall response is flat without excesisve ripple.
Thanks Mark, I see what you're saying. After reading that document (http://www.rane.com/note101.html), it's all making sense! Thank you guys, you've been very helpful! -- Adam