This is a collection of digital biquad filters whose parameters f
(frequency in Hz), g
(gain in dB) and q
(quality) can be varied at runtime. Following DF1 filter implementations are available:
- Allpass
- Bandpass
- Highpass
- Lowpass
- Highshelf
- Lowshelf
- Notch
- Peak
Filter with static configuration:
import biquad
import numpy as np
# load audio samples somehow
x, sr = np.zeros(...), 44100
# create a filter of your choice
f = biquad.bandpass(sr, f=sr/4, q=1)
# process all audio samples
y = f(x)
Filter with dynamic configuration:
import biquad
import numpy as np
# load audio samples somehow
x, sr = np.zeros(...), 44100
# create a filter of your choice
f = biquad.bandpass(sr)
# create parameter modifications as you like
myf = np.linspace(1, sr/4, len(x))
myq = np.linspace(2, 1/2, len(x))
# process all audio samples
y = f(x, f=myf, q=myq)
Keep in mind:
- All filters have a default value for the persistent parameters
g
andq
, which is set in the particular__init__
method. - Parameter
f
must be set either in the__init__
or in the__call__
method. - The optional instantaneous parameters
f
,g
andq
, if specified in the__call__
method, override the persistent ones.
- Cookbook formulae for audio EQ biquad filter coefficients by Robert Bristow-Johnson
- Introduction to Digital Filters with Audio Applications by Julius O. Smith III
github.com/jurihock/biquad is licensed under the terms of the MIT license. For details please refer to the accompanying LICENSE file distributed with it.