Biquad Filter¶
Second-order IIR (biquad) filter supporting seven filter types. Based on the Audio EQ Cookbook by Robert Bristow-Johnson.
Transfer function:
Only five multiplications and four additions per sample, making it efficient for real-time audio.
Filter types¶
Constant |
Type |
Description |
|---|---|---|
|
Low-pass |
Passes frequencies below the cutoff |
|
High-pass |
Passes frequencies above the cutoff |
|
Band-pass |
Passes frequencies near the centre frequency |
|
Notch |
Rejects frequencies near the centre frequency |
|
Peaking EQ |
Boost or cut at the centre frequency |
|
Low shelf |
Boost or cut all frequencies below the cutoff |
|
High shelf |
Boost or cut all frequencies above the cutoff |
- class pyminidsp.BiquadFilter(filter_type, freq, sample_rate, db_gain=0.0, bandwidth=1.0)[source]¶
Biquad (second-order IIR) filter.
Supports low-pass, high-pass, band-pass, notch, peaking EQ, low shelf, and high shelf filter types.
Example
>>> filt = BiquadFilter(LPF, freq=1000.0, sample_rate=44100.0) >>> for sample in signal: ... output = filt.process(sample)
# Low-pass at 1 kHz, process a full signal lpf = md.BiquadFilter(md.LPF, freq=1000.0, sample_rate=44100.0) filtered = lpf.process_array(signal) # Peaking EQ: +6 dB at 3 kHz eq = md.BiquadFilter(md.PEQ, freq=3000.0, sample_rate=44100.0, db_gain=6.0) # Sample-by-sample processing for sample in signal: out = lpf.process(sample)