Biquad filter design: the RBJ cookbook, explained
A biquad — a second-order IIR section, two poles and two zeros — is the workhorse of audio. Eight useful filters come out of the same transfer function by swapping six coefficients, which is why a parametric EQ, a crossover, a de-esser and a loudness compensator are all the same code with different numbers.
The numbers come from the Audio EQ Cookbook by Robert Bristow-Johnson, and it earns its
name. This page derives where each term comes from, generates the coefficients for all
eight types, and states the two properties that catch people out: that the
A = 10^(dBgain/40) exponent is not a typo, and that Q and bandwidth are not
exact inverses of each other.
Biquad coefficient generator
Coefficients in the raw cookbook form and normalised so that a0 = 1, with the response and group delay measured from them.
- Intermediate omega0
- —
- A and alpha
- —
- Q
- —
- Equivalent bandwidth
- —
- Normalised b
- —
- Normalised a
- —
- Gain at DC
- —
- Gain at the frequency
- —
- Gain at Nyquist
- —
- Group delay at the frequency
- —
- Pole radius
- —
Magnitude response
—Group delay
the delay in samples that each frequency experiencesCoefficients
—
The response is measured from the coefficients rather than from a separate formula, so the gain rows are a check on the design: a low-pass reads 1 at DC and 1/√2 at its corner when Q = 1/√2, and the peaking filter reads exactly its requested gain at the centre. The group delay is a numerical derivative of the phase, in samples.
One transfer function, eight filters
Every biquad is the same ratio of quadratics in z−1:
In the form you actually implement, a0 is divided out and the feedback terms move to the other side of the equals sign:
That sign — minus the feedback — is where half of all biquad bugs live. The transfer
function has +a₁z−1 in the denominator; the
difference equation has −a₁y[n−1]. Both conventions are
correct and they describe the same filter, so a coefficient set copied between them
without changing the signs produces a filter that is stable and wrong.
The three intermediates
Everything in the cookbook is built from three quantities, and the design is entirely in getting them right:
The /40 in A looks like a mistake next to the usual
10dB/20 for amplitude ratios, and it is not. Take the peaking
filter, whose coefficients are b₀ = 1 + αA and
a₀ = 1 + α/A, and evaluate the response at
ω₀. Multiplying numerator and denominator by
ejω₀ collapses both to a single imaginary term, and the
A-dependent parts leave:
So the peak gain is A² = 10dBgain/20, which is exactly
dBgain in decibels. The /40 is what makes the gain parameter mean what you
would expect. The generator confirms it: asking for +6 dB gives 6.000000 dB at the
centre frequency for any Q. For the shelves the same A² shows up as the shelf
height, which is why 6 dB at DC really is 6 dB at DC.
What each type guarantees
These are measured from the generated coefficients, not asserted from the formulas:
| Type | Gain at DC | Gain at f₀ | Gain at Nyquist |
|---|---|---|---|
| Low-pass | 1 | Q | 0 |
| High-pass | 0 | Q | 1 |
| Band-pass (constant peak) | 0 | 1, whatever Q is | 0 |
| Notch | 1 | 0 exactly | 1 |
| All-pass | 1 | 1 | 1 |
| Peaking EQ | 1 | 10dBgain/20 | 1 |
| Low shelf | 10dBgain/20 | half the gain in dB | 1 |
| High shelf | 1 | half the gain in dB | 10dBgain/20 |
Two rows deserve attention. The low-pass and high-pass gain Q at their corner, which is why Q = 1/√2 puts the corner at −3.01 dB and why a Q of 2 puts a 6 dB peak right at the cutoff — that is not a bug, it is the definition, and it is the reason a resonant filter rings. And the shelves reach only half their gain in dB at the shelf frequency: a 12 dB shelf is 6 dB up at f₀, measured. Practitioners often expect the corner where the response is 3 dB below the shelf level, which is a point further out.
Q and bandwidth are not exact inverses
The cookbook offers two ways to specify a width, and they are not two spellings of one
parameter. For Q it uses
α = sinω₀/(2Q); for a bandwidth in octaves it uses
The Q form as a function of BW is Q = 1/(2 sinh(ln2/2 · BW)), which
is the same expression only when the extra
ω₀/sinω₀ factor is 1 — true at DC and increasingly
untrue as the frequency rises. At 1 kHz in a 48 kHz system the factor is 1.0025, and the
two designs differ by 0.29% in α, which is small but not nothing: it shifts the
corner and the Q a little. At 20 Hz they agree to six digits.
The practical rule: pick one parameterisation and stay in it. If you must convert, use the ω₀-aware form, which the generator exposes and which reproduces the bandwidth design exactly at any frequency. The approximation is the one most code uses, and it is the reason two "identical" 10 kHz bell filters can measure slightly differently.
Shelf slope, and where the corner really is
Shelving filters take a third parameter, and it is not Q. For shelves the cookbook defines α from a slope S:
S = 1 is the steepest slope that keeps the response monotonic, and it collapses the
square root to exactly √2 for any gain, so
α = sinω₀/√2 — the shelf's equivalent of a
Butterworth Q. Smaller S gives a larger α and a steeper shelf, which also means
more overshoot near the corner. Below a certain S the term under the square root goes
negative and no filter exists at all: at 20 dB of gain that happens below
S ≈ 1.25, and the generator refuses the design rather than returning a filter with
no real response.
Phase, group delay, and why the choice against FIR matters
A biquad is cheap — five multiplies per sample — and its magnitude response is exact at DC, at f₀ and at Nyquist, because the design is derived from a bilinear transform with pre-warping. What it is not is linear phase. Its delay varies with frequency, and that variation is large near the corner: a 1 kHz low-pass with Q = 1/√2 has a group delay of 10.79 samples at DC, rising to 11.8 samples at 900 Hz, against a predicted 10.79 from the analogue prototype.
That is the trade against the windowed-sinc FIR from the FIR article: the FIR gives constant group delay at the cost of hundreds of taps, the biquad gives the same magnitude shape for five. For a crossover, the FIR's flat delay is often worth the taps; for a tone control it never is. The exception worth knowing is the all-pass, which is a biquad designed to change only the phase: its magnitude is 1 at every frequency, its phase passes through −180° at f₀, and its group delay peaks there. Cascading all-passes is how a phase response gets shaped without touching the magnitude.
Five mistakes worth avoiding
- Using 10dB/20 for A. It has to be 10dB/40, or every peaking and shelving gain comes out at double the value you asked for.
- Copying coefficients between the two sign conventions. The difference equation subtracts the feedback terms; the transfer function adds them.
- Expecting the shelf corner at the shelf gain minus 3 dB. It is at half the gain in dB: 3 dB up for a 6 dB shelf, 6 dB up for a 12 dB shelf.
- Treating Q and bandwidth as interchangeable. The conversion is exact only as the frequency approaches DC; above a few kHz the difference is measurable.
- Designing a filter at a frequency close to Nyquist and expecting the shape you drew. The design is exact at DC, f₀ and Nyquist, but the bilinear transform warps everything between, which is why an 18 kHz low-pass in a 48 kHz system does not look like a scaled-down 1 kHz one.
Numerical notes for implementation
All of these designs were checked across 560 combinations of type, Q, gain and frequency, and every pole stayed inside the unit circle. That is expected: for a stable design |a₂| < 1, and the cookbook's formulas guarantee it. The pole radius is reported by the generator because it is the number that matters for numerical behaviour: as it approaches 1 the filter becomes more resonant and more sensitive to coefficient rounding, so a very low-frequency high-Q biquad in single precision is worth a second look. Double precision is comfortable for everything in the audio band.
Summary
Compute ω₀, cosω₀ and A = 10dBgain/40, resolve one α from Q, bandwidth or slope, and the six coefficients follow. Check the design by measuring what it does rather than by re-reading the formulas: the corner of a low-pass should read Q, a peaking filter should read its requested gain at the centre, and a shelf should read half its gain at the shelf frequency.
Values shown are engineering aids rather than measurements; see the disclaimer and the tool index.