pub struct Denoiser { /* private fields */ }Expand description
RNNoise noise suppression as a mic-chain stage. One instance per stream — the network is stateful across frames.
Implementations§
Source§impl Denoiser
impl Denoiser
Sourcepub fn new(mic_hz: u32) -> Self
pub fn new(mic_hz: u32) -> Self
A denoiser for a microphone stream at mic_hz (the same rate given
to pump_processed).
Sourcepub fn vad_probability(&self) -> f32
pub fn vad_probability(&self) -> f32
Speech probability in [0, 1] from RNNoise’s VAD head — the same
recurrent features that drive the suppression gains, read out as a
per-block classifier. Updated every 10 ms block the denoiser
processes (the maximum across the blocks consumed by the most recent
process_frame call); 0.0 before the first
full block.
This is a learned VAD: it responds to the statistical fingerprint of speech (pitch movement, formants, syllabic modulation), not to level. Measured on the module-docs benchmark it separates cleanly — speech medians 0.76–0.96 against noise medians ≈ 0.00 for pink and street-traffic scenes (horns, engines) even at 0 dB SNR. Use it as the decision path for turn-taking (poll after each pumped frame, add hysteresis: on above ≈ 0.6, off below ≈ 0.3 with a ~300 ms hangover) where an energy-threshold VAD would false-trigger on loud non-speech.
Two measured caveats: babble and competing talkers score as speech (they are speech — see the module docs on level gating), and loud sustained broadband white noise from stream start can hold the head high until its noise estimate converges, so pair the probability with hysteresis rather than acting on a single block.
Trait Implementations§
Source§impl InputAudioProcessor for Denoiser
impl InputAudioProcessor for Denoiser
Source§fn process_frame(&mut self, frame: &mut Vec<i16>)
fn process_frame(&mut self, frame: &mut Vec<i16>)
Auto Trait Implementations§
impl Freeze for Denoiser
impl RefUnwindSafe for Denoiser
impl Send for Denoiser
impl Sync for Denoiser
impl Unpin for Denoiser
impl UnwindSafe for Denoiser
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
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].