pub struct Biquad { /* private fields */ }Expand description
A biquad filter implementation for audio equalization.
This struct implements a second-order IIR filter using the biquad algorithm. It maintains internal state (x1, x2, y1, y2) for processing continuous audio streams. The filter coefficients are calculated based on the RBJ Audio EQ Cookbook formulas.
The filter supports shelf and peak responses for tone stack equalization.
Implementations§
Source§impl Biquad
impl Biquad
Sourcepub fn new_shelf(
shelf: ShelfType,
sample_rate: f32,
freq: f32,
gain_db: f32,
) -> Self
pub fn new_shelf( shelf: ShelfType, sample_rate: f32, freq: f32, gain_db: f32, ) -> Self
Creates a new biquad shelf filter with the specified parameters.
§Arguments
shelf- The type of shelf filter (Low, High, or Peak).sample_rate- The sample rate of the audio signal (e.g., 44100.0).freq- The center/cutoff frequency in Hz.gain_db- The gain in decibels (positive for boost, negative for cut).
§Returns
A new Biquad instance configured with the calculated coefficients.
Sourcepub fn set_gain_db(&mut self, gain_db: f32)
pub fn set_gain_db(&mut self, gain_db: f32)
Updates the gain of the biquad filter.
Recalculates the filter coefficients based on the new gain value while keeping the same frequency and shelf type. The internal state is preserved.
§Arguments
gain_db- The new gain in decibels.
Auto Trait Implementations§
impl Freeze for Biquad
impl RefUnwindSafe for Biquad
impl Send for Biquad
impl Sync for Biquad
impl Unpin for Biquad
impl UnsafeUnpin for Biquad
impl UnwindSafe for Biquad
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more