pub struct Model {
pub name: Option<String>,
pub architecture: String,
pub loudness: Option<f64>,
/* private fields */
}Expand description
A loaded model, ready to process audio (mono, at its sample rate, normally 48 kHz).
Fields§
§name: Option<String>Display name from the file’s metadata, if any.
architecture: StringThe architecture as written in the file ("WaveNet", "SlimmableContainer").
loudness: Option<f64>The model’s loudness in dB, from the file’s metadata (written by the NAM trainer: the model’s output level on its standard input). NAM plugins normalise the output with it.
Implementations§
Source§impl Model
impl Model
pub fn load(path: impl AsRef<Path>) -> Result<Model, NamError>
pub fn from_json_str(s: &str) -> Result<Model, NamError>
Sourcepub fn process(&mut self, input: &[f32], output: &mut [f32])
pub fn process(&mut self, input: &[f32], output: &mut [f32])
Process a block (any length; state carries over between calls).
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Back to the state after loading (history cleared, then prewarmed with silence).
Sourcepub fn sample_rate(&self) -> Option<f64>
pub fn sample_rate(&self) -> Option<f64>
The sample rate the model was trained at, if the file says.
Trait Implementations§
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> 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