Cookbook formulae for audio equalizer biquad filter coefficients
- Robert Bristow-Johnson
- Doug Schepers (previously W3C)
- Editor's Draft:
Adapted from http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt, with permission.
All filter transfer functions were derived from analog prototypes (that
are shown below for each equalizer (EQ) filter type) and had been digitized using the
Bilinear Transform (BLT). BLT frequency warping has been taken into account for
both significant frequency relocation (this is the normal "prewarping" that
is necessary when using the BLT) and for bandwidth readjustment (since the
bandwidth is compressed when mapped from analog to digital using the BLT).
First, given a biquad transfer function defined as:
This shows 6 coefficients instead of 5 so, depending on your architecture,
you will likely normalize
to be 1 and perhaps also
to 1 (and collect that into an overall gain coefficient). Then your transfer function would
The most straight forward implementation would be the "Direct Form 1" (equation 2):
This is probably both the best and the easiest method to implement in the
56K and other fixed-point or floating-point architectures with a double
Begin with these user defined parameters:
- the sampling frequency
- Center Frequency or Corner Frequency, or shelf midpoint frequency,
depending on which filter type. The "significant frequency".
"wherever it's happenin', man."
- used only for peaking and shelving filters
- or or
- the EE kind of definition, except for peakingEQ in which A*Q is
the classic EE Q. That adjustment in definition was made so that
a boost of N dB followed by a cut of N dB for identical Q and
f0/Fs results in a precisely flat unity gain filter or "wire".
- the bandwidth in octaves (between -3 dB frequencies for BPF
and notch or between midpoint (dBgain/2) gain frequencies for
- a "shelf slope" parameter (for shelving EQ only). When S = 1,
the shelf slope is as steep as it can be and remain monotonically
increasing or decreasing gain with frequency. The shelf slope, in
dB/octave, remains proportional to S for all other values for a
fixed f0/Fs and dBgain
Then compute a few intermediate variables:
FYI: The relationship between bandwidth and Q is
digital filter with BLT
analog filter prototype
The relationship between shelf slope and Q is
is a handy intermediate variable for shelving EQ filters.
Finally, compute the coefficients for whichever filter type you want:
(The analog prototypes, H(s), are shown for each filter type for normalized frequency.)
(constant skirt gain,
peak gain = Q)
(constant 0 dB peak gain)
FYI: The bilinear transform (with compensation for frequency warping) substitutes:
and makes use of these trig identities:
resulting in these substitutions:
is common to all terms in both numerator and denominator, can be factored
out, and thus be left out in the substitutions above resulting in:
In addition, all terms, numerator and denominator, can be multiplied by a
common factor, finally resulting in these substitutions:
The biquad coefficient formulae above come out after a little simplification.
Special thanks to Robert Bristow-Johnson for creating the Audio EQ Cookbook and permitting its adaption and use for the Web Audio API.
Thanks to Peter Jipsen, creator of ASCIIMathML, for making it easier to convert ASCII math notation to MathML.