Wiki / Audio / Digital Biquad Filters
Digital Biquad Filters
Second-order recursive linear filtering.
Brief
Biquad refers to the fact that the transfer function of the filter is the ratio of two quadratic functions:
\(H(z) = {b_{0} + b_{1}z^{-1} + b_{2}z^{-2} \over {a_{0} + a_{1}z^{-1} + a_{2}z^{-2}}}\)
Higher-order IIR filters are prone to instability due to coefficient quantization, so they are often implemented as cascaded biquad sections, ensuring all poles remain inside the unit circle in the Z-domain for stability.
Second-order filters are also very simple to implement, as they only require managing six coefficient values and four state values. Implementing a biquad filter is as simple as defining the difference equation:
\( y_{n} = {b_{0} \over a_{0}}x_{n} + {b_{1} \over a_{0}}x_{n - 1} + {b_{2} \over a_{0}}x_{n - 2} - {a_{1} \over a_{0}}y_{n - 1} - {a_{2} \over a_{0}}y_{n - 2}\)
The coefficients \( b_{0} \over a_{0} \), \( b_{1} \over a_{0} \), etc. can be pre-computed.
Filter types
Each type below has its own page with an interactive frequency-response plot and the coefficient formulae:
Low Pass
Passes below the cutoff, attenuates above it.
BiquadHigh Pass
Passes above the cutoff, attenuates below it.
BiquadBand Pass
Passes a band around a center frequency.
BiquadNotch
Rejects a narrow band around a center frequency.
BiquadAll Pass
Flat magnitude, frequency-dependent phase shift.
BiquadPeaking EQ
Boosts or cuts a band around a center frequency.
BiquadLow Shelf
Boosts or cuts everything below the cutoff.
BiquadHigh Shelf
Boosts or cuts everything above the cutoff.
Implementation
You can find a C++ and Rust implementation of various biquad filters on my GitHub page:
alex-parisi/biquad-filtersC++ and Rust implementations of every biquad filter type described here.