Skip to main content

BiquadCascade

Struct BiquadCascade 

Source
pub struct BiquadCascade<T, const N: usize> {
    pub sections: [Biquad<T>; N],
}
Expand description

A cascade of N biquad (second-order) sections.

Filter order is 2*N for all-second-order sections, or 2*N - 1 when the last section is a degenerate first-order biquad (b2 = a2 = 0).

§Example

use numeris::control::{butterworth_lowpass, BiquadCascade};

// 4th-order Butterworth → 2 biquad sections
let mut lpf: BiquadCascade<f64, 2> = butterworth_lowpass(4, 1000.0, 8000.0).unwrap();
let y = lpf.tick(1.0);

Fields§

§sections: [Biquad<T>; N]

Implementations§

Source§

impl<T: FloatScalar, const N: usize> BiquadCascade<T, N>

Source

pub fn tick(&mut self, x: T) -> T

Process a single input sample through all sections in series.

Source

pub fn reset(&mut self)

Reset all sections’ internal state to zero.

Source

pub fn process(&mut self, input: &[T], output: &mut [T])

Process a slice of input samples into an output slice.

§Panics

Panics if output.len() < input.len().

Source

pub fn process_inplace(&mut self, data: &mut [T])

Process a slice of samples in-place.

Source

pub fn order(&self) -> usize

Actual filter order (detects degenerate first-order last section).

Trait Implementations§

Source§

impl<T: Clone, const N: usize> Clone for BiquadCascade<T, N>

Source§

fn clone(&self) -> BiquadCascade<T, N>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug, const N: usize> Debug for BiquadCascade<T, N>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Copy, const N: usize> Copy for BiquadCascade<T, N>

Auto Trait Implementations§

§

impl<T, const N: usize> Freeze for BiquadCascade<T, N>
where T: Freeze,

§

impl<T, const N: usize> RefUnwindSafe for BiquadCascade<T, N>
where T: RefUnwindSafe,

§

impl<T, const N: usize> Send for BiquadCascade<T, N>
where T: Send,

§

impl<T, const N: usize> Sync for BiquadCascade<T, N>
where T: Sync,

§

impl<T, const N: usize> Unpin for BiquadCascade<T, N>
where T: Unpin,

§

impl<T, const N: usize> UnsafeUnpin for BiquadCascade<T, N>
where T: UnsafeUnpin,

§

impl<T, const N: usize> UnwindSafe for BiquadCascade<T, N>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.