Skip to main content

Model

Enum Model 

Source
#[non_exhaustive]
pub enum Model { WaveNet(WaveNet), Lstm(Lstm), }
Expand description

A runnable NAM model of any supported architecture.

Build with Model::from_nam; then call Model::process_buffer on the audio thread. #[non_exhaustive] so future architectures don’t break downstream matches.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

WaveNet(WaveNet)

A WaveNet model.

§

Lstm(Lstm)

An LSTM model.

Implementations§

Source§

impl Model

Source

pub fn from_nam(model: &NamModel) -> Result<Self, Error>

Build the runtime matching model.architecture. All allocation happens here.

Source

pub fn process_buffer(&mut self, io: &mut [f32])

Process a buffer of mono samples in place. Allocation-free.

Source

pub fn process_sample(&mut self, x: f32) -> f32

Process a single mono sample. Allocation-free.

Source

pub fn sample_rate(&self) -> f64

The model’s sample rate.

Source

pub fn reset(&mut self)

Reset all internal state to the model’s initial conditions.

Trait Implementations§

Source§

impl Debug for Model

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Model

§

impl RefUnwindSafe for Model

§

impl Send for Model

§

impl Sync for Model

§

impl Unpin for Model

§

impl UnsafeUnpin for Model

§

impl UnwindSafe for Model

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> 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, 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.