Equalizer Coefficients

View: New views
4 Messages — Rating Filter:   Alert me  

Equalizer Coefficients

by Ronzani Bruno :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi !

I am trying to make an Equalizer in C++ using RBJ Filters.

I want it to be very generic, thus you can add as much points as you want.

Each point is specified by its frequency and of course its gain.

For example it could be :

200Hz : +0.3
500Hz : +0.7
5000Hz : -0.1
5100Hz : +0.2

(so you see that you don't have the same range between each point)

My main idea is to make the sum of all the filters to the current
audio, ie, in pseudo code :

double output = 0
for each point P of the equalizer do:
   output += applyFilter(intput, P.frequency ) * P.Volume
done
return output;


is this the correct way to do it ?!

Of course, my main problem is how to calculate the Q coefficient  ?

For now, what I do is :

if it's the first point of my Equalizer, I use a LOWSHELF filter
if it's the last point, I use a HISHELF filter
else I use a BANDPASS filter

then, for each filter, I set the Q value -- here Q is a bandwidth -- to :

nextPoint.Frequency - currentPoint.Frequency

I guess it's not correct... how should I do this in a better way ?

Thank a lot, I hope I am clear enough...

Bruno Ronzani
--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp links
http://music.columbia.edu/cmc/music-dsp 
http://music.columbia.edu/mailman/listinfo/music-dsp

Re: Equalizer Coefficients

by Ronzani Bruno :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello again... I still didn't manage to do it.

Is this a good idea to use RBJ Filters to make an equalizer ?

Thanks,

Bruno

2009/11/2 Ronzani Bruno <bruno.ronzani@...>:

> Hi !
>
> I am trying to make an Equalizer in C++ using RBJ Filters.
>
> I want it to be very generic, thus you can add as much points as you want.
>
> Each point is specified by its frequency and of course its gain.
>
> For example it could be :
>
> 200Hz : +0.3
> 500Hz : +0.7
> 5000Hz : -0.1
> 5100Hz : +0.2
>
> (so you see that you don't have the same range between each point)
>
> My main idea is to make the sum of all the filters to the current
> audio, ie, in pseudo code :
>
> double output = 0
> for each point P of the equalizer do:
>   output += applyFilter(intput, P.frequency ) * P.Volume
> done
> return output;
>
>
> is this the correct way to do it ?!
>
> Of course, my main problem is how to calculate the Q coefficient  ?
>
> For now, what I do is :
>
> if it's the first point of my Equalizer, I use a LOWSHELF filter
> if it's the last point, I use a HISHELF filter
> else I use a BANDPASS filter
>
> then, for each filter, I set the Q value -- here Q is a bandwidth -- to :
>
> nextPoint.Frequency - currentPoint.Frequency
>
> I guess it's not correct... how should I do this in a better way ?
>
> Thank a lot, I hope I am clear enough...
>
> Bruno Ronzani
>
--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp links
http://music.columbia.edu/cmc/music-dsp 
http://music.columbia.edu/mailman/listinfo/music-dsp

Re: Equalizer Coefficients

by robert bristow-johnson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



it appears that you're stringing these together in cascade, with the  
shelving filters as "bookends".  if you're trying to use these as a  
means of doing a sorta generalized graphic eq (with fixed frequencies  
and Qs), then you should try to space these peaking EQs equally in  
log frequency.  then their bandwidth (in octaves) should be  
*something* like the spacing (in octaves).  in the cookbook, there is  
a formula that relates the bandwidth (in octaves) to the Q.

but maybe your app is a true parametric where you're moving f0  
around, then you can have whatever you want.

--

r b-j

On Nov 2, 2009, at 12:31 PM, Ronzani Bruno wrote:

> Hello again... I still didn't manage to do it.
>
> Is this a good idea to use RBJ Filters to make an equalizer ?
>
> Thanks,
>
> Bruno
>
> 2009/11/2 Ronzani Bruno <bruno.ronzani@...>:
>> Hi !
>>
>> I am trying to make an Equalizer in C++ using RBJ Filters.
>>
>> I want it to be very generic, thus you can add as much points as  
>> you want.
>>
>> Each point is specified by its frequency and of course its gain.
>>
>> For example it could be :
>>
>> 200Hz : +0.3
>> 500Hz : +0.7
>> 5000Hz : -0.1
>> 5100Hz : +0.2
>>
>> (so you see that you don't have the same range between each point)
>>
>> My main idea is to make the sum of all the filters to the current
>> audio, ie, in pseudo code :
>>
>> double output = 0
>> for each point P of the equalizer do:
>>   output += applyFilter(intput, P.frequency ) * P.Volume
>> done
>> return output;
>>
>>
>> is this the correct way to do it ?!
>>
>> Of course, my main problem is how to calculate the Q coefficient  ?
>>
>> For now, what I do is :
>>
>> if it's the first point of my Equalizer, I use a LOWSHELF filter
>> if it's the last point, I use a HISHELF filter
>> else I use a BANDPASS filter
>>
>> then, for each filter, I set the Q value -- here Q is a bandwidth  
>> -- to :
>>
>> nextPoint.Frequency - currentPoint.Frequency
>>
>> I guess it's not correct... how should I do this in a better way ?
>>
>> Thank a lot, I hope I am clear enough...
>>

--

r b-j                  rbj@...

"Imagination is more important than knowledge."




--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp links
http://music.columbia.edu/cmc/music-dsp 
http://music.columbia.edu/mailman/listinfo/music-dsp

Re: Equalizer Coefficients

by Thomas Rehaag :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Bruno,

for your code:
> double output = 0
> for each point P of the equalizer do:
>    output += applyFilter(intput, P.frequency ) * P.Volume
> done
> return output;
you need normal low/hi/band pass filters, but you'll not be satisfied
with the resulting curves, especially not if attenuate a band's volume.

Better use the peak and shelf filters and do something like:
double output = input;
input = LowShelfe(input);
input = HighShelfe(input);
for(all bands)
        input = Peak(input);

You should find examples on musicdsp.org

> Of course, my main problem is how to calculate the Q coefficient  ?

The question is what you want to create.
(1) an EQ with adjacent bands or
(2) a conventional parametric EQ with random f0 and Q for N bands.
If you want to set random mid frequencies, the cutoff frequencies won't
match so that fcUpper[n] == fcLower[n+1].
If you'd like to have an EQ with adjacent bands, you'll have to set
'split points' to insert a new band and the mid frequencies will follow.

Best Regards,

Thomas
--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp links
http://music.columbia.edu/cmc/music-dsp 
http://music.columbia.edu/mailman/listinfo/music-dsp