Skip to content

Wiki / Biquad Filters / All Pass Filters

All Pass Filters

Digital biquad filtering.

Brief

A second-order biquad all-pass filter preserves the amplitude of all frequencies while altering their phase, using a combination of two poles and two zeros arranged symmetrically. It is implemented with a difference equation employing both feedback and feedforward coefficients, allowing precise control over the phase shift characteristics around a specified center frequency and bandwidth (Q factor). All-pass filters are often used in phase correction, group delay adjustment, and filter design applications.

Try it

Drag the sliders to see how the magnitude and phase response change. Sample rate is 48 kHz; the dashed line marks \(f_{0}\), and the normalized coefficients update live.

Formulae

In order to construct a biquad all pass filter, the sample rate, center frequency, and Q-factor need to be provided. From those, the coefficients for the underlying filter can be calculated.

First, some intermediate values are calculated:

  • \(\displaystyle ω_{0} = 2π{f_{0} \over F_{s}}\)
  • \(\displaystyle α = {sin(ω_{0}) \over {2Q}}\)

Where \(f_{0}\) is the center frequency, \(F_{s}\) is the sample rate, and \(Q\) is the Q-factor.

Then, the filter coefficients can be calculated:

  • \(\displaystyle b_{0} = 1 - α\)
  • \(\displaystyle b_{1} = -2cos(ω_{0})\)
  • \(\displaystyle b_{2} = 1 + α\)
  • \(\displaystyle a_{0} = 1 + α\)
  • \(\displaystyle a_{1} = -2cos(ω_{0})\)
  • \(\displaystyle a_{2} = 1 - α\)

Implementation

You can find a C++ and Rust implementation of this and other biquad filters on my GitHub page:

alex-parisi/biquad-filters

C++ and Rust implementations of every biquad filter type described here.

Notes

Since Q-factor is a unit-less value and is a little hard to quantify, sometimes it is easier to provide bandwidth instead. Bandwidth can be converted to the Q-factor by using the formula:

\(\displaystyle Q = {1 \over {2sinh(BW ⋅ {log_{10}(2) \over 2})}}\)