Biquad (second order IIR) filter coefficients from the Audio EQ Cookbook by Robert Bristow-Johnson.
Every function returns a [[BiquadConf]] for the difference equation
y[n] = b0 x[n] + b1 x[n-1] + b2 x[n-2] - a1 y[n-1] - a2 y[n-2]
with b0 b1 b2 a1 a2 already divided by a0 (the cookbook sign convention, as scipy.signal.lfilter with a = [1 a1 a2]); a0 is kept unnormalized.
Common arguments:
fc - center or corner frequency, 0 < fc < fs/2fs - sample ratebw - bandwidth in octaves (between -3 dB points for band filters, between midpoint gain points for the peaking equalizer), converted with the digital cookbook formula, see bandwidth->Qgain - gain in dB (peaking and shelving filters)Q - shelf quality factor; shelf-slope->Q converts the cookbook shelf slope SThrows ex-info when fc is not in (0, fs/2) or bw, Q are not positive.
Reference: https://webaudio.github.io/Audio-EQ-Cookbook/Audio-EQ-Cookbook.txt
Biquad (second order IIR) filter coefficients from the Audio EQ Cookbook by Robert Bristow-Johnson. Every function returns a [[BiquadConf]] for the difference equation `y[n] = b0 x[n] + b1 x[n-1] + b2 x[n-2] - a1 y[n-1] - a2 y[n-2]` with `b0 b1 b2 a1 a2` already divided by `a0` (the cookbook sign convention, as `scipy.signal.lfilter` with `a = [1 a1 a2]`); `a0` is kept unnormalized. Common arguments: * `fc` - center or corner frequency, `0 < fc < fs/2` * `fs` - sample rate * `bw` - bandwidth in octaves (between -3 dB points for band filters, between midpoint gain points for the peaking equalizer), converted with the digital cookbook formula, see [[bandwidth->Q]] * `gain` - gain in dB (peaking and shelving filters) * `Q` - shelf quality factor; [[shelf-slope->Q]] converts the cookbook shelf slope `S` Throws `ex-info` when `fc` is not in `(0, fs/2)` or `bw`, `Q` are not positive. Reference: https://webaudio.github.io/Audio-EQ-Cookbook/Audio-EQ-Cookbook.txt
(allpass fc bw fs)All pass filter (phase shift, unit magnitude): center frequency fc, bandwidth bw octaves, sample rate fs.
All pass filter (phase shift, unit magnitude): center frequency `fc`, bandwidth `bw` octaves, sample rate `fs`.
(bandpass fc bw fs)Band pass filter with 0 dB peak gain: center frequency fc, bandwidth bw octaves, sample rate fs.
Band pass filter with 0 dB peak gain: center frequency `fc`, bandwidth `bw` octaves, sample rate `fs`.
(bandwidth->Q bw)(bandwidth->Q bw fc fs)Converts bandwidth bw in octaves to the quality factor Q.
[bw] - analog prototype: 1 / (2 sinh(ln(2)/2 bw))[bw fc fs] - digital filter (Audio EQ Cookbook, bilinear transform warping): 1 / (2 sinh(ln(2)/2 bw w0/sin(w0))), w0 = 2 pi fc / fsThe biquad functions of this namespace use the digital form.
Converts bandwidth `bw` in octaves to the quality factor `Q`. * `[bw]` - analog prototype: `1 / (2 sinh(ln(2)/2 bw))` * `[bw fc fs]` - digital filter (Audio EQ Cookbook, bilinear transform warping): `1 / (2 sinh(ln(2)/2 bw w0/sin(w0)))`, `w0 = 2 pi fc / fs` The biquad functions of this namespace use the digital form.
(equalizer fc gain bw fs)Peaking equalizer: gain dB at fc, bandwidth bw octaves, sample rate fs.
Peaking equalizer: `gain` dB at `fc`, bandwidth `bw` octaves, sample rate `fs`.
(highpass fc bw fs)High pass filter: corner frequency fc, bandwidth bw octaves, sample rate fs.
High pass filter: corner frequency `fc`, bandwidth `bw` octaves, sample rate `fs`.
(highshelf fc gain Q fs)High shelf: gain dB above fc, quality factor Q (see shelf-slope->Q), sample rate fs.
High shelf: `gain` dB above `fc`, quality factor `Q` (see [[shelf-slope->Q]]), sample rate `fs`.
(lowpass fc bw fs)Low pass filter: corner frequency fc, bandwidth bw octaves, sample rate fs.
Low pass filter: corner frequency `fc`, bandwidth `bw` octaves, sample rate `fs`.
(lowshelf fc gain Q fs)Low shelf: gain dB below fc, quality factor Q (see shelf-slope->Q), sample rate fs.
Low shelf: `gain` dB below `fc`, quality factor `Q` (see [[shelf-slope->Q]]), sample rate `fs`.
(notch fc bw fs)Notch (band stop) filter: center frequency fc, bandwidth bw octaves, sample rate fs.
Notch (band stop) filter: center frequency `fc`, bandwidth `bw` octaves, sample rate `fs`.
(Q->bandwidth Q)(Q->bandwidth Q fc fs)Converts the quality factor Q to bandwidth in octaves, the inverse of bandwidth->Q (analog [Q] or digital [Q fc fs]).
Converts the quality factor `Q` to bandwidth in octaves, the inverse of [[bandwidth->Q]] (analog `[Q]` or digital `[Q fc fs]`).
(shelf-slope->Q gain S)Converts the cookbook shelf slope S (1 is the steepest monotonic slope) for a shelf of gain dB to the quality factor Q.
1/Q = sqrt((A + 1/A)(1/S - 1) + 2), A = 10^(gain/40). Throws ex-info when S is not positive or too large for the gain (negative square root).
Converts the cookbook shelf slope `S` (1 is the steepest monotonic slope) for a shelf of `gain` dB to the quality factor `Q`. `1/Q = sqrt((A + 1/A)(1/S - 1) + 2)`, `A = 10^(gain/40)`. Throws `ex-info` when `S` is not positive or too large for the gain (negative square root).
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |