pub struct Biquad {
pub b0: f32,
pub b1: f32,
pub b2: f32,
pub a1: f32,
pub a2: f32,
pub z1: f32,
pub z2: f32,
pub filter_type: BiquadType,
}Expand description
Second-order IIR biquad filter (Direct Form II Transposed).
Transfer function: H(z) = (b0 + b1·z⁻¹ + b2·z⁻²) / (1 + a1·z⁻¹ + a2·z⁻²)
Fields§
§b0: f32§b1: f32§b2: f32§a1: f32§a2: f32§z1: f32§z2: f32§filter_type: BiquadTypeThe kind of filter (informational).
Implementations§
Source§impl Biquad
impl Biquad
Sourcepub fn new(
b0: f32,
b1: f32,
b2: f32,
a1: f32,
a2: f32,
filter_type: BiquadType,
) -> Self
pub fn new( b0: f32, b1: f32, b2: f32, a1: f32, a2: f32, filter_type: BiquadType, ) -> Self
Create a biquad from raw coefficients.
Sourcepub fn process_sample(&mut self, x: f32) -> f32
pub fn process_sample(&mut self, x: f32) -> f32
Process a single sample (Direct Form II Transposed).
Sourcepub fn magnitude_response(&self, omega: f32) -> f32
pub fn magnitude_response(&self, omega: f32) -> f32
Frequency response magnitude at normalized frequency ω (0..π).
Trait Implementations§
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§
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.