pub struct WaveNet { /* private fields */ }Expand description
A ready-to-run WaveNet, with all scratch buffers pre-allocated.
Implementations§
Source§impl WaveNet
impl WaveNet
Sourcepub fn new(model: &NamModel) -> Result<Self, Error>
pub fn new(model: &NamModel) -> Result<Self, Error>
Build a runnable model from a parsed .nam file.
All allocation happens here. Fails if the architecture is unsupported, an activation is unknown, or the flat weight blob does not match the config.
Sourcepub fn receptive_field(&self) -> usize
pub fn receptive_field(&self) -> usize
Receptive field in samples: how far back the deepest dilated tap reaches.
This is the model’s warmup length and its processing latency. The first
receptive_field() output samples of a fresh (or freshly reset)
model are a startup transient computed against zero-filled history, so they
reflect the streaming zero-init convention (matching NAM Core / NeuralAudio)
rather than a training-time forward pass that pre-pads the whole input.
Sourcepub fn sample_rate(&self) -> f64
pub fn sample_rate(&self) -> f64
The model’s sample rate (from the source .nam, or the NAM default).
Sourcepub fn process_buffer(&mut self, io: &mut [f32])
pub fn process_buffer(&mut self, io: &mut [f32])
Process a buffer of mono samples in place.
Runs the block kernel: each MAX_BLOCK-sized chunk is pushed through one
array (and one layer) at a time, keeping each weight matrix hot across the
whole chunk. Bit-for-bit equivalent to looping Self::process_sample, and
it shares the same streaming history, so the two are interchangeable.
Real-time contract: no heap allocation, locks, or syscalls. Enforced by
tests/rt_safety.rs.
Sourcepub fn process_sample(&mut self, x: f32) -> f32
pub fn process_sample(&mut self, x: f32) -> f32
Process a single mono sample, returning one output sample.
Equivalent to a one-element Self::process_buffer; convenient for
callers that are not buffer-oriented. Allocation-free.