# RBJ peaking filter -- off by 2 X

Started by November 12, 2003
```hi,
i've been messing about w/ the peaking filters in RBJs eq cookbook and
everything has been great. ....

my test is to generate a bunch of white noise with a uniform
distribution. and take before and after "frequency analyses" of the
peaking filter (using a big blackmanharris window and 64k point fft) it
is here that i'm seeing my resonant peak off by 2X, eg a peak 500 Hz,
given a center frequency of 250 Hz.  My bandwidth is 1 octave and sr =
44100, and dB gain = 10 db (so i can see the peak )

it seems that the resonant peak is exactly off by 1/2.  i basically
plugged RBJs equations exactly ...and have tripled checked.... a bit
baffled where this factor of 2 might be coming from.
any ideas?

In the past i've used normalized frequencies i.e. 0-pi, but here it
seems that the Hz value is what the cookbook takes ....is that correct?

thanks,
sdj

```
```actually solved my problem, wasn't keeping around separate filter
history for left and right channels ...d'uh!!!! :)

sammy davis jr. wrote:
> hi,
> i've been messing about w/ the peaking filters in RBJs eq cookbook and
> everything has been great. ....
>
> my test is to generate a bunch of white noise with a uniform
> distribution. and take before and after "frequency analyses" of the
> peaking filter (using a big blackmanharris window and 64k point fft) it
> is here that i'm seeing my resonant peak off by 2X, eg a peak 500 Hz,
> given a center frequency of 250 Hz.  My bandwidth is 1 octave and sr =
> 44100, and dB gain = 10 db (so i can see the peak )
>
> it seems that the resonant peak is exactly off by 1/2.  i basically
> plugged RBJs equations exactly ...and have tripled checked.... a bit
> baffled where this factor of 2 might be coming from.
> any ideas?
>
> In the past i've used normalized frequencies i.e. 0-pi, but here it
> seems that the Hz value is what the cookbook takes ....is that correct?
>
> thanks,
> sdj
>

```
```I've used the peaking filter with correct results.  If you can't find any
errors in the filter implementation, maybe the error is in your frequency
analysis?  Try your FFT on a sine wave of known frequency.

As long as your sample rate and center frequency are both in the same units
(Hz, rad/sec, whatever), the cookbook formulae should work because it
defines everything in terms of a normalized "omega" (omega =
2*pi*frequency/sampleRate).

Also, make sure you are using the latest version which can be found here:
http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt
I know that there were a few errors in the first version or two Robert
posted which were later corrected, a success story for "peer review"!

"sammy davis jr." <sdj@ratpackproductions.com> wrote in message
news:Kknsb.5389\$IK2.499355@news20.bellglobal.com...
> hi,
> i've been messing about w/ the peaking filters in RBJs eq cookbook and
> everything has been great. ....
>
> my test is to generate a bunch of white noise with a uniform
> distribution. and take before and after "frequency analyses" of the
> peaking filter (using a big blackmanharris window and 64k point fft) it
> is here that i'm seeing my resonant peak off by 2X, eg a peak 500 Hz,
> given a center frequency of 250 Hz.  My bandwidth is 1 octave and sr =
> 44100, and dB gain = 10 db (so i can see the peak )
>
> it seems that the resonant peak is exactly off by 1/2.  i basically
> plugged RBJs equations exactly ...and have tripled checked.... a bit
> baffled where this factor of 2 might be coming from.
> any ideas?
>
> In the past i've used normalized frequencies i.e. 0-pi, but here it
> seems that the Hz value is what the cookbook takes ....is that correct?
>
> thanks,
> sdj
>

```
```Cool.  Ignore my previous post then!  It's always the little things that get
you.

"sammy davis jr." <sdj@ratpackproductions.com> wrote in message
news:Huvsb.5969\$IK2.596480@news20.bellglobal.com...
> actually solved my problem, wasn't keeping around separate filter
> history for left and right channels ...d'uh!!!! :)
>
> sammy davis jr. wrote:
> > hi,
> > i've been messing about w/ the peaking filters in RBJs eq cookbook and
> > everything has been great. ....
> >
> > my test is to generate a bunch of white noise with a uniform
> > distribution. and take before and after "frequency analyses" of the
> > peaking filter (using a big blackmanharris window and 64k point fft) it
> > is here that i'm seeing my resonant peak off by 2X, eg a peak 500 Hz,
> > given a center frequency of 250 Hz.  My bandwidth is 1 octave and sr =
> > 44100, and dB gain = 10 db (so i can see the peak )
> >
> > it seems that the resonant peak is exactly off by 1/2.  i basically
> > plugged RBJs equations exactly ...and have tripled checked.... a bit
> > baffled where this factor of 2 might be coming from.
> > any ideas?
> >
> > In the past i've used normalized frequencies i.e. 0-pi, but here it
> > seems that the Hz value is what the cookbook takes ....is that correct?
> >
> > thanks,
> > sdj
> >
>

```
```In article bou0kp\$1i19nn\$1@ID-210375.news.uni-berlin.de, Jon Harris at
goldentully@hotmail.com wrote on 11/12/2003 14:16:

> I've used the peaking filter with correct results.  If you can't find any
> errors in the filter implementation, maybe the error is in your frequency
> analysis?  Try your FFT on a sine wave of known frequency.
>
> As long as your sample rate and center frequency are both in the same units
> (Hz, rad/sec, whatever), the cookbook formulae should work because it
> defines everything in terms of a normalized "omega" (omega =
> 2*pi*frequency/sampleRate).
>
> Also, make sure you are using the latest version which can be found here:
> http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt
> I know that there were a few errors in the first version or two Robert
> posted which were later corrected, a success story for "peer review"!

but i think they were screw-ups in the shelving filters or maybe just the
high-shelf filter.  i would have to look at Google or maybe music-dsp
archives to see the history, but i'm too lazy to.

i'm thinking of doing the cookbook up nice and PDFizing it.  think i should?
one reason i hesitate is that with the Orfanidis improvement to the peaking
and now Knud Christianson of TC Electronic has done a generalization to the
peaking and shelving (where there are 4 degrees of freedom not counting
constant gain), i think the dust should settle a little and then someone
(maybe not me) should do the final, ultimate, never to be improved upon,
audio biquad cookbook.  whad'ya folks think?

r b-j

```
```i think its a great idea...

what btw, was wrong with the high shelf filter equations ??

robert bristow-johnson wrote:
><snip>
>
> but i think they were screw-ups in the shelving filters or maybe just the
> high-shelf filter.  i would have to look at Google or maybe music-dsp
> archives to see the history, but i'm too lazy to.
>
> i'm thinking of doing the cookbook up nice and PDFizing it.  think i should?
> one reason i hesitate is that with the Orfanidis improvement to the peaking
> and now Knud Christianson of TC Electronic has done a generalization to the
> peaking and shelving (where there are 4 degrees of freedom not counting
> constant gain), i think the dust should settle a little and then someone
> (maybe not me) should do the final, ultimate, never to be improved upon,
> audio biquad cookbook.  whad'ya folks think?
>
> r b-j
>

```
```"robert bristow-johnson" <rbj@surfglobal.net> wrote in message
news:BBD870C6.5967%rbj@surfglobal.net...
> In article bou0kp\$1i19nn\$1@ID-210375.news.uni-berlin.de, Jon Harris at
> goldentully@hotmail.com wrote on 11/12/2003 14:16:
>
> > I've used the peaking filter with correct results.  If you can't find
any
> > errors in the filter implementation, maybe the error is in your
frequency
> > analysis?  Try your FFT on a sine wave of known frequency.
> >
> > As long as your sample rate and center frequency are both in the same
units
> > (Hz, rad/sec, whatever), the cookbook formulae should work because it
> > defines everything in terms of a normalized "omega" (omega =
> > 2*pi*frequency/sampleRate).
> >
> > Also, make sure you are using the latest version which can be found
here:
> >
http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt
> > I know that there were a few errors in the first version or two Robert
> > posted which were later corrected, a success story for "peer review"!
>
> but i think they were screw-ups in the shelving filters or maybe just the
> high-shelf filter.  i would have to look at Google or maybe music-dsp
> archives to see the history, but i'm too lazy to.
>
> i'm thinking of doing the cookbook up nice and PDFizing it.  think i
should?
> one reason i hesitate is that with the Orfanidis improvement to the
peaking
> and now Knud Christianson of TC Electronic has done a generalization to
the
> peaking and shelving (where there are 4 degrees of freedom not counting
> constant gain), i think the dust should settle a little and then someone
> (maybe not me) should do the final, ultimate, never to be improved upon,
> audio biquad cookbook.  whad'ya folks think?
>
> r b-j

Sounds like a great idea.  One other thing I'd suggest adding is first-order
versions of some or all of the filter types.  Myself, I've derived most of
these and I would be happy to contribute to this effort.  I've used the
cookbook pretty extensively over the years so I certainly wouldn't mind
giving back a little!

What are the Orfanidis and Christianson improvements?  Are they published
somewhere?

```
```On Thu, 13 Nov 2003 11:55:24 -0800, "Jon Harris"
<goldentully@hotmail.com> wrote:

>"robert bristow-johnson" <rbj@surfglobal.net> wrote in message
>news:BBD870C6.5967%rbj@surfglobal.net...
>> In article bou0kp\$1i19nn\$1@ID-210375.news.uni-berlin.de, Jon Harris at
>> goldentully@hotmail.com wrote on 11/12/2003 14:16:
>>
>> > I've used the peaking filter with correct results.  If you can't find
>any
>> > errors in the filter implementation, maybe the error is in your
>frequency
>> > analysis?  Try your FFT on a sine wave of known frequency.
>> >
>> > As long as your sample rate and center frequency are both in the same
>units
>> > (Hz, rad/sec, whatever), the cookbook formulae should work because it
>> > defines everything in terms of a normalized "omega" (omega =
>> > 2*pi*frequency/sampleRate).
>> >
>> > Also, make sure you are using the latest version which can be found
>here:
>> >
>http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt
>> > I know that there were a few errors in the first version or two Robert
>> > posted which were later corrected, a success story for "peer review"!
>>
>> but i think they were screw-ups in the shelving filters or maybe just the
>> high-shelf filter.  i would have to look at Google or maybe music-dsp
>> archives to see the history, but i'm too lazy to.
>>
>> i'm thinking of doing the cookbook up nice and PDFizing it.  think i
>should?
>> one reason i hesitate is that with the Orfanidis improvement to the
>peaking
>> and now Knud Christianson of TC Electronic has done a generalization to
>the
>> peaking and shelving (where there are 4 degrees of freedom not counting
>> constant gain), i think the dust should settle a little and then someone
>> (maybe not me) should do the final, ultimate, never to be improved upon,
>> audio biquad cookbook.  whad'ya folks think?
>>
>> r b-j
>
>Sounds like a great idea.  One other thing I'd suggest adding is first-order
>versions of some or all of the filter types.  Myself, I've derived most of
>these and I would be happy to contribute to this effort.  I've used the
>cookbook pretty extensively over the years so I certainly wouldn't mind
>giving back a little!
>
>What are the Orfanidis and Christianson improvements?  Are they published
>somewhere?

Hi guys,
well if you guys *do* refine (and maybe expand) this
"eq cookbook", one of our colleagues here on this
newsgroup is an associate editor for the IEEE Signal
Processing magazine.

I'll bet he'd be interested in looking at your
final "cookbook" for possible publication.
Ya' never know.

[-Rick-]

```
```robert bristow-johnson <rbj@surfglobal.net> wrote in
news:BBD870C6.5967%rbj@surfglobal.net:

> i'm thinking of doing the cookbook up nice and PDFizing it.  think i
> should? one reason i hesitate is that with the Orfanidis improvement
> to the peaking and now Knud Christianson of TC Electronic has done a
> generalization to the peaking and shelving (where there are 4 degrees
> of freedom not counting constant gain), i think the dust should settle
> a little and then someone (maybe not me) should do the final,
> ultimate, never to be improved upon, audio biquad cookbook.  whad'ya
> folks think?
>
> r b-j
>

What would you call it?

rbj, Christianson, Orfanidis, Crosby, Stills, Nash & Young?

--
Al Clark
Danville Signal Processing, Inc.
--------------------------------------------------------------------
Purveyors of Fine DSP Hardware and other Cool Stuff
Available at http://www.danvillesignal.com
```
```Since this is for audio filters, I think adding "Linkwitz Riley" would be
appropriate! :-)

"Al Clark" <dsp@danvillesignal.com> wrote in message
news:Xns9432A452BC890aclarkdanvillesignal@66.133.130.30...
> robert bristow-johnson <rbj@surfglobal.net> wrote in
> news:BBD870C6.5967%rbj@surfglobal.net:
>
> > i'm thinking of doing the cookbook up nice and PDFizing it.  think i
> > should? one reason i hesitate is that with the Orfanidis improvement
> > to the peaking and now Knud Christianson of TC Electronic has done a
> > generalization to the peaking and shelving (where there are 4 degrees
> > of freedom not counting constant gain), i think the dust should settle
> > a little and then someone (maybe not me) should do the final,
> > ultimate, never to be improved upon, audio biquad cookbook.  whad'ya
> > folks think?
> >
> > r b-j
> >
>
> What would you call it?
>
> rbj, Christianson, Orfanidis, Crosby, Stills, Nash & Young?

```