Struct SallenKey

Source
pub struct SallenKey { /* private fields */ }
Expand description

This is a 2-pole lowpass filter.

This is a 2-pole lowpass filter loosely based on the one found in the second revision of the Korg MS20 synthesizer. It distorts really nicely and gets especially gnarly when resonance is high. My personal favorite.

It’s able to self-oscillate and starts doing so when its resonance is above 0.8.

OTA core, nonlinear op-amp buffers. Resonance is limited by a diode clipper, but it disappears quite quickly at high drives.

Its convergence is generally good, but it does get a bit slower at high drives. The parameter vector for the nonlinear contributions is just 2 entries long, meaning that it might be reasonable to create a lookup table to guarantee stable, fast runtime. <- not as reasonable as I thought, also needs entries for g and res

Circuit solved by Holters & Zölzer’s generalization of the DK-method.

The fast version is optimized by removing unnecessary operations and replacing the general solver with an analytic solution of the specific model. At some point I’ll look into how a simd-optimized version would compare, since most of the operations are dot products anyway, but the current fast version is definitely fast enough for real-time use in DAW projects. pub struct SallenKey { filters: [SallenKeyCoreFast; 2], }

Implementations§

Source§

impl SallenKey

Source

pub fn new(params: Arc<FilterParams>) -> Self

Source

pub fn process(&mut self, input: f32x4) -> f32x4

Process a stereo sample.

Source

pub fn update(&mut self)

Call this whenver the resonance or cutoff frequency of the FilterParams change.

Source

pub fn reset(&mut self)

Reset the filter.

Trait Implementations§

Source§

impl Clone for SallenKey

Source§

fn clone(&self) -> SallenKey

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 Debug for SallenKey

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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.