RBJ's Audio EQ cookbook takes into account only frequency prewarping when case Q is used for bandwidth. Why not $Q$ prewarping as well with some of those filter types defined there? At KVR I got info that BLT turns to kind of II (Impulse Invariant) when both prewarpings are in use and BLT looses some nice properties in that case.

Well, I tried the $Q$ prewarping and made few plots:

enter image description here

Right column plots uses EE's $Q$ definition just for the (original) cookbook. Did not check the situation of phases.

If my plots are correct then it looks like prewarping $Q$ might bring some improvement at least for peak filter magnitude. For LP filter, situation is different.

BTW, some doctoral thesis showed plots where both prewarpings were used and set to have same factor. How's that factoring done?

Any thoughts?

EDIT: Plots showing the end results for this query. enter image description here Clarifications can be found from RBJ's answer and comments related to that answer.

  • $\begingroup$ Can you link to that doctoral thesis? $\endgroup$
    – Matt L.
    Commented Jul 19, 2016 at 17:42
  • $\begingroup$ @MattL Link for Ph.D. thesis of Dr. Robin J. Clark can be found from here $\endgroup$
    – Juha P
    Commented Jul 19, 2016 at 19:04

1 Answer 1


alright, there are a couple of different issues that may (or may not) need to be de-conflated.

i'm gonna try to keep the number of symbols minimized.

$dB_\text{gain}$ is the number of dB gain of the peak (for $dB_\text{gain} > 0$) or cut (for $dB_\text{gain} < 0$). it appears to be 6 dB in the plots.

$$A^2 \triangleq 10^{dB_\text{gain}/20}$$

is the linear gain for the boost or cut.

$f_\text{s}$ is sample rate.

$f_0$ is frequency of the boost or cut in the same units as the sample rate.

the analog transfer function of a resonant second-order filter (a.k.a. "biquad" or "SOS") is

$$\begin{align} \\ H(s) &= \frac{b_0 + b_1 s + b_2 s^2 }{1 + a_1 s + a_2 s^2} \\ \\ &= \frac{b_0 + b_1 s + b_2 s^2}{1 + \frac{1}{Q}\frac{s}{2 \pi f_0} + \left(\frac{s}{2 \pi f_0} \right)^2} \\ \\ \end{align} $$

don't mistake the $a_k, \ b_k$ coefficients of the analog prototype with those in the resulting digital filter from the recipe in the cookbook. this is how the "EE definition" of $Q$ is defined.

an analog BPF with passband gain of 0 dB, has transfer function:

$$ H(s) = \frac{ \frac{1}{Q}\frac{s}{2 \pi f_0} }{1 + \frac{1}{Q}\frac{s}{2 \pi f_0} + \left(\frac{s}{2 \pi f_0} \right)^2} $$

note when $f = f_0$ then $H(j 2 \pi f_0) = 1$. note also that there are two bandedges $f_+$ and $f_-$ such that $f_- < f_0 < f_+$ and

$$ f_+ = f_0 \cdot 2^{bw/2} $$ $$ f_- = f_0 \cdot 2^{-bw/2} $$


$$ |H(j 2 \pi f_-)|^2 = |H(j 2 \pi f_+)|^2 = \frac{1}{2} \quad . $$

we define those bandedges for the BPF to be the "half-power frequencies" (a.k.a. "-3 dB frequencies"). and the $bw$ parameter is the bandwidth expressed in octaves. the higher bandedge $f_+ = 2^{bw} f_-$ is $bw$ octaves higher log frequency than the lower bandedge $f_-$. turns out that this bandwidth $bw$ in octaves is related to $Q$ as follows:

$$\begin{align} \\ \frac{1}{Q} &= \frac{2^{bw} - 1}{2^{bw/2}} \\ \\ &= 2 \ \sinh \left( \frac{\ln(2)}{2} \ bw \right) \\ \end{align} $$

keeping the same definition of $Q$, the "bell-shaped" boost/cut parametric EQ takes that BPF, gives it some gain (with sign) and adds it to a wire. it has transfer function:

$$\begin{align} H(s) &= (A^2 - 1)\frac{ \frac{1}{Q}\frac{s}{2 \pi f_0} }{1 + \frac{1}{Q}\frac{s}{2 \pi f_0} + \left(\frac{s}{2 \pi f_0} \right)^2} \ + 1 \\ \\ &= \frac{1 + \frac{A^2}{Q}\frac{s}{2 \pi f_0} + \left(\frac{s}{2 \pi f_0} \right)^2}{1 + \frac{1}{Q}\frac{s}{2 \pi f_0} + \left(\frac{s}{2 \pi f_0} \right)^2}\\ \end{align}$$

this is the "traditional" analog parametric EQ. note that $$|H(j 2 \pi f_0)| = A^2 = 10^{dB_\text{gain}/20} \quad .$$ the problem is that, leaving $f_0$ and $Q$ constant, the curve for $dB_\text{gain} > 0$ is not a mirror image for $dB_\text{gain} < 0$, given the same number of dB, $|dB_\text{gain}|$, boost or cut. the cut will be much skinnier than the boost.

some people might want the cut to exactly undo the boost given all other parameters being the same. so in the cookbook (and in some other papers), a redefinition of $Q$ is made. this redefinition is the substitution:

$$ Q \ \leftarrow \ A \cdot Q $$

so that makes the transfer function for the parametric EQ (with adjusted $Q$):

$$\begin{align} H(s) &= \frac{1 + \frac{A^2}{A \cdot Q}\frac{s}{2 \pi f_0} + \left(\frac{s}{2 \pi f_0} \right)^2}{1 + \frac{1}{A \cdot Q}\frac{s}{2 \pi f_0} + \left(\frac{s}{2 \pi f_0} \right)^2} \\ \\ &= \frac{1 + \frac{A}{Q}\frac{s}{2 \pi f_0} + \left(\frac{s}{2 \pi f_0} \right)^2}{1 + \frac{1}{A \ Q}\frac{s}{2 \pi f_0} + \left(\frac{s}{2 \pi f_0} \right)^2} \\ \end{align} $$

note that if $dB_\text{gain}$ is replaced with $-dB_\text{gain}$, then $A$ is replaced with $\frac{1}{A}$ and the numerator and denominator of $H(s)$ are essentially swapped, which causes the frequency response of the cut to mirror that of the boost.

now, using the same relationship between bandwidth $bw$ and $Q$:

$$ \frac{1}{Q} = 2 \ \sinh \left( \frac{\ln(2)}{2} \ bw \right) $$

then the bandedges

$$ f_+ = f_0 \cdot 2^{+bw/2} $$ $$ f_- = f_0 \cdot 2^{-bw/2} $$

satisfy this gain definition:

$$ |H(j 2 \pi f_-)| = |H(j 2 \pi f_+)| = A = 10^{dB_\text{gain}/40} $$

which are the "mid-gain frequencies" having dB gain of $\frac{dB_\text{gain}}{2}$.

so the definition of bandedge gain is a bit different, but at least for the analog prototype, we're keeping the relationship between $bw$ and $Q$ the same. higher $Q$ means tighter $bw$.

so, first, before we discuss "warping Q", let's be completely consistent about which Q to compare. for this, i might recommend leaving the "EE definition" of Q behind to not confuse.

so the bilinear transform which compensates for the frequency warping at the "significant frequency" or the resonant frequency $f_0$ makes this substitution:

$$ \text{normalized }s \triangleq \frac{s}{2 \pi f_0} \ \leftarrow \ \frac{1}{\tan(\pi f_0/f_\text{s})} \ \frac{1 - z^{-1}}{1 + z^{-1}} $$

$H(z)$ is the resulting digital filter transfer function after making that substitution for normalized $s$.

the frequency warping function turns out to be:

$$ f_\text{analog} = \frac{f_0}{\tan\left(\pi \frac{f_0}{f_\text{s}} \right)} \ \tan\left( \pi \frac{f_\text{digital}}{f_\text{s}} \right) $$ or $$ f_\text{digital} = \frac{f_\text{s}}{\pi} \ \arctan \left( \tan\left(\pi \frac{f_0}{f_\text{s}} \right) \frac{f_\text{analog}}{f_0} \right) $$

(note that DC gets mapped to DC and $f_0$ gets mapped to $f_0$, but when $f_\text{analog} \to \infty$, then $f_\text{digital} \to \frac{f_\text{s}}{2}$.)

fixing (or "prewarping") $f_0$ does not compensate for a cramped bandwidth because, besides the resonant frequency $f_0$, so also are the bandedges $f_+$ and $f_-$ warped by the bilinear transform. measured in octaves the bandwidth, $BW$, in the digital filter is:

$$\begin{align} BW &= \log_2\left( \frac{f_\text{s}}{\pi} \arctan \left( \tan\left(\pi \frac{f_0}{f_\text{s}} \right) \right) \frac{f_+}{f_0} \right) - \log_2\left( \frac{f_\text{s}}{\pi} \arctan \left( \tan\left(\pi \frac{f_0}{f_\text{s}} \right) \frac{f_-}{f_0} \right) \right) \\ \\ &= \log_2\left(\arctan \left(\tan\left(\pi \frac{f_0}{f_\text{s}}\right) 2^{+bw/2} \right) \right) - \log_2\left(\arctan \left(\tan\left(\pi \frac{f_0}{f_\text{s}}\right) 2^{-bw/2} \right) \right) \\ \\ &= \log_2\left(\frac{\arctan \left(\tan\left(\pi \frac{f_0}{f_\text{s}}\right) 2^{+bw/2} \right)}{\arctan \left(\tan\left(\pi \frac{f_0}{f_\text{s}}\right) 2^{-bw/2} \right)} \right) \\ \\ \end{align}$$

you can see that the mapping of $bw$ to $BW$ is an odd-symmetry function, so it goes through $0$ and has no even-order terms in a Maclaurin (a.k.a. Taylor series) expansion. now if you fix $f_0$ and plot digital $BW$ vs. analog $bw$, you will see that $BW < bw$ and that is the bandwidth cramping done by frequency warping of the bilinear transform. to uncramp the bandwidth, you would have to solve for $bw$ in terms of $BW$ and $f_0$ and $f_\text{s}$. and that is (how shall we say?) a female canine.

if you read the cookbook a little, you will notice a slightly adjusted mapping between $BW$ and $Q$:

$$ \frac{1}{Q} = 2 \ \sinh \left( \frac{\ln(2)}{2} \ BW \frac{2 \pi f_0/f_\text{s}}{\sin(2 \pi f_0/f_\text{s})} \right) $$

so the digital filter bandwidth $BW$ was increased by a factor of $\frac{2 \pi f_0/f_\text{s}}{\sin(2 \pi f_0/f_\text{s})}$ as a first-order attempt to compensate for the bandwidth cramping. this result comes from assuming a narrow bandwidth in the first place and evaluating the derivative:

$$ \frac{\partial \, BW}{\partial \, bw} \Bigg|_{bw = 0} = \frac{\sin(2 \pi f_0/f_\text{s})}{2 \pi f_0/f_\text{s}} $$

the first term of the Maclaurin series is

$$ BW \approx \frac{\sin(2 \pi f_0/f_\text{s})}{2 \pi f_0/f_\text{s}} bw $$

compensating (or "prewarping") that first-order cramping of the bandwidth (which is what i think you mean by "prewarping Q") is done in the cookbook and always has been. but it is only a first-order compensation. if you want to do it better, be my guest and try to compute the next third-order term for the Maclaurin expansion (and flip it around so you have an expression of the approximate analog $bw$ in terms of digital $BW$). doing this with Maclaurin series expansion is the only way i know because i don't think you will invert the $bw \to BW$ mapping above directly.

  • $\begingroup$ so then, what is the difference between the blue and the green plots? does the blue plot not use the uncramped BW and the green plot uses the uncramped BW? and BTW, the cramping compensation happens first to $BW$, then you use that $\sinh()$ function to get $Q$. $\endgroup$ Commented Jul 20, 2016 at 17:21
  • $\begingroup$ Yes, left columns blue are result from the unmodified cookbook calculation and both columns green are the result got with warped Q. I'm using the 'case Q' from cookbook : alpha = sin(w0)/(2*Q) ... going to check the 'case bw' as well. $\endgroup$
    – Juha P
    Commented Jul 20, 2016 at 18:20
  • $\begingroup$ do check that case. because there is no other uncramping of $BW$ other than in that case. the reason why is that there are these other filters in the cookbook. a LPF with high Q has a bump with height that is a function of $Q$. i wanted that bump to be the same size, so i did not modify $Q$ in that context. it is only the $BW$ parameter that is uncramped. i don't use your $\tan()$ formula anywhere. so, to compare to analog, use the case BW:. $\endgroup$ Commented Jul 20, 2016 at 19:09
  • $\begingroup$ OK. Building filter using case BW instead of case Q improves the output of cookbook's peak filter. Added the plot to my 1st post. $\endgroup$
    – Juha P
    Commented Jul 21, 2016 at 6:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.