pub struct Denoiser { /* private fields */ }Expand description
Streaming noise suppressor. Stereo uses two independent RNNoise states, one per channel (no crosstalk between channels).
See the crate-level documentation for details on latency and carry-over.
Implementations§
Source§impl Denoiser
impl Denoiser
Sourcepub fn new(channels: u16) -> Result<Denoiser, DenoiseError>
pub fn new(channels: u16) -> Result<Denoiser, DenoiseError>
Create with a channel count (1 = mono, 2 = interleaved stereo).
Sourcepub fn process(&mut self, interleaved: &mut [f32]) -> Result<(), DenoiseError>
pub fn process(&mut self, interleaved: &mut [f32]) -> Result<(), DenoiseError>
Apply noise suppression in place to any-length interleaved samples (normalized ±1.0, 48 kHz). Length must be a multiple of the channel count (an empty slice is a no-op).
Internally splits input into frames of FRAME_SIZE samples per channel and carries any
remainder to the next call. Output is delayed by FRAME_SIZE samples per channel, with
silence (0.0) at the start of the stream. Chunk boundaries do not change the output sequence.
Output samples are clamped to ±1.0.
Sourcepub fn flush(&mut self) -> Vec<f32>
pub fn flush(&mut self) -> Vec<f32>
Zero-pad the carried remainder to one frame and process it, then return the final delayed
FRAME_SIZE samples per channel as interleaved output and close the stream.
Total output is now total input + FRAME_SIZE samples per channel (initial silence padding).
After this call, the denoiser returns to the same initial state as Denoiser::reset and
can process a new stream.