# [music-dsp] crossover filters for compressor

robert bristow-johnson rbj at audioimagination.com
Thu Mar 22 22:28:10 EDT 2007

```> ----- Original Message -----
> From: "Peter Schoffhauzer" <scoofy at inf.elte.hu>
> To: "A discussion list for music-related DSP" <music-dsp at music.columbia.edu>
> Subject: Re: [music-dsp] crossover filters for compressor
> Date: Fri, 23 Mar 2007 01:36:42 +0100
>
>
> I know that you realized that error, I just made a proof that those two are
> equivalent (and not to offend you in any way :)

i'm not offended.  i just knew i screwed up (after i was confident i did not) and then (from your response) did not understand that you understood that i understood (??!!) that i screwed up and where i screwed up.

> By the way I respect your knowledge in this field, which I think is far
> vaster than mine.

i wasn't trying to one-up anyone.  i was just so sure that i did it right (and your expression either had to be wrong or equivalent to mine) until i saw that i did it wrong.  that's embarassing when i post it as a cookbook recipe.

so, just to be clear:

======================================

for an Nth order Butterworth LPF or HPF, one can cascade floor(N/2) biquad LPF or HPF sections in the cookbook, set f0 (and w0) to be the same for all sections and set the Q for each according to

1/Q =  = 2*sin( (pi/N)*(n + 1/2) )

where n is the section number and  0 <= n < floor(N/2).

since alpha = sin(w0)/(2*Q) in the cookbook, then

alpha = sin(w0) * sin( (pi/N)*(n + 1/2) )     0 <= n < floor(N/2)

this works for even or odd N.  but for odd N, there still needs to be an additional 1st-order section where the normalized s-plane pole is at -1.  i think that section will look like

H(z) = (b0 + b1*z^-1) / (a0 + a1*z^-1)

where

b0 = b1 = sin(w0)
a0 = sin(w0) - cos(w0) + 1
a1 = sin(w0) - cos(w0) - 1

no Q or alpha term.  i think that's safely correct.  it can be carved into stone (someone please lettuce know if this is messed up).  to implement, the a0 term has to be normalized to 1. (some people like it if the tan(w0/2) is left in there, but i find tan(.) to be a sorta bitch computing with a power series, particularly in fixed point.)  all this futzing around for stupid odd-order Butterworth.

======================================

maybe someday i'll post a formulae for using the cookbook for Tchebyshev and Inverse Tchebyshev (somethimes called Chebyshev Type 1 and Type 2).

>  > Peter, i know they're the same.  i also know that my
>  > original that had the "cos" substituting for the "sin"
>  > was in error.  i immediately posted when i realized
>  > the error. i was being fecitious in answering
>  > your "Are you sure?" question.  check the
>  > answer to it.  my mistake is simply that of:
> >
> >      p_n = exp(j*(pi/2 + pi/(2N) + n*pi/N))      for 0 <= n < N
> >
> > (up to here it's correct.)  now:
> >
> >  2*Re{p_n} = 2*cos(pi/2 + pi/(2N) + n*pi/N)
> >    = 2*(cos(pi/2)*cos(pi*(1+2n)/(2N)) - sin(pi/2)*sin(pi*(1+2n)/(2N)))
> >    = 2*(   1     *cos(pi*(1+2n)/(2N)) -    0     *sin(pi*(1+2n)/(2N)))
> >    = 2*cos(pi*(1+2n)/(2N))
> >
> > so what did i do wrong?  (or another question is: how many things did i do
> > wrong?)
>
> I think the only error here is the sin/cos(pi/2) substitution.

i forgot to include the other mistake.

> However, a few
> things are not totally clear to me (for example why "twice the real part of
> the normalized pole is 1/Q").

THAT's the other mistake.  1/Q is twice the *negative* of the real part of the normalized pole (reason shown below).  that compoundment of mistake let me accept the cos(.) term as reasonable since i knew that 1/Q is positive.  had i not made the 2nd mistake, i would have seen right away that the -2*cos(.) term had to be wrong.

> I calculated my equation using the general form
> of the Butterworth polynomials by realizing the relationship between 1/Q and
> the s coefficient:
>
>    B_n(s) = product(n=1..N/2, s^2 - 2*s*cos(pi*(2*n+N-1)/2*N) + 1)
>
> The coefficient gives 1/Q directly, I just simplified it.

we know two things (normalized w0):

H(s) = (some numerator) / (1 + s/Q + s^2)

and

H(s) = (possibly some other numerator) / ( (s-p)*(s-conj(p))

= (...) / ( s^2 - (p + conj(p))*s + p*conj(p) )

= (...) / (s^2 - 2*Re{p}*s +|p|^2 )

since we're saying that p is a normalized pole, that means that |p|=1.  equate the two and

1/Q = -2*Re(p)

if we were to do this more legit, replace every normalized "s" with "s/w0" and you will see that

|p| = w0

and

1/Q = -2*Re{p}/|p|

if the horse wasn't dead before, this should have finished it off.

--

r b-j                  rbj at audioimagination.com

"Imagination is more important than knowledge."

```