pub struct Denoiser { /* private fields */ }Expand description
RNNoise-based noise suppressor.
Wraps nnnoiseless::DenoiseState with frame buffering to handle
arbitrary input chunk sizes. Automatically resamples to/from 48kHz
when the input sample rate differs.
Implementations§
Source§impl Denoiser
impl Denoiser
Sourcepub fn new(sample_rate: u32) -> Self
pub fn new(sample_rate: u32) -> Self
Create a new denoiser.
§Arguments
sample_rate- Input sample rate in Hz. Common values: 16000, 48000.
If the sample rate is not 48kHz, the denoiser will automatically resample to 48kHz for processing and back to the original rate.
§Panics
Panics if resamplers cannot be created (should not happen with valid rates).
Sourcepub fn sample_rate(&self) -> u32
pub fn sample_rate(&self) -> u32
Returns the sample rate this denoiser was configured for.
Sourcepub fn is_resampling(&self) -> bool
pub fn is_resampling(&self) -> bool
Returns true if resampling is being used.
Sourcepub fn process(&mut self, samples: &[i16]) -> Vec<i16>
pub fn process(&mut self, samples: &[i16]) -> Vec<i16>
Process audio samples through the noise suppressor.
Input samples are i16 values at the configured sample rate. Returns denoised samples at the same sample rate. Due to frame buffering (and resampling if applicable), output length may differ from input length.
Sourcepub fn process_aligned(&mut self, samples: &[i16]) -> Vec<i16>
pub fn process_aligned(&mut self, samples: &[i16]) -> Vec<i16>
Process a complete buffer of samples (must be multiple of FRAME_SIZE).
This is more efficient when you know your input is frame-aligned.
Sourcepub fn buffered_samples(&self) -> usize
pub fn buffered_samples(&self) -> usize
Returns the number of samples currently buffered.