pub struct VadConfig {
pub sample_rate: u32,
pub frame_duration_ms: u32,
pub start_threshold_db: f64,
pub stop_threshold_db: f64,
pub min_speech_frames: u32,
pub hangover_frames: u32,
pub speech_zcr_range: (f64, f64),
pub initial_noise_floor_db: f64,
pub pre_speech_frames: usize,
}Expand description
VAD configuration parameters.
Fields§
§sample_rate: u32Sample rate in Hz.
frame_duration_ms: u32Frame duration in milliseconds (typically 10–30ms).
start_threshold_db: f64Energy threshold (dBFS) above noise floor to trigger speech start.
stop_threshold_db: f64Energy threshold (dBFS) above noise floor to end speech.
min_speech_frames: u32Minimum speech duration in frames before confirming speech.
hangover_frames: u32Hangover duration in frames — keeps “speaking” state after energy drops.
speech_zcr_range: (f64, f64)ZCR range for speech confirmation (low, high).
initial_noise_floor_db: f64Initial noise floor estimate (dBFS).
pre_speech_frames: usizeNumber of pre-speech frames to buffer.
Implementations§
Source§impl VadConfig
impl VadConfig
Sourcepub fn frame_size(&self) -> usize
pub fn frame_size(&self) -> usize
Number of samples per frame.
Sourcepub fn noisy_street() -> Self
pub fn noisy_street() -> Self
Tuned for noisy environments behind a denoiser (the L2
voice::Denoiser, feature denoise) — do not use on a raw noisy
stream, where the energy floor latches regardless of threshold.
Found by a latency-aware parameter sweep over labeled street-traffic, pink, and white scenes (clean → 0 dB SNR): with the signal denoised, the threshold can be raised to 21 dB (rejecting horn and engine residue) while the onset confirmation drops to a single frame (~150–310 ms measured onset). On the same benchmark the shipped defaults behind the denoiser score 174–312 ms onset with more residual open time; on street traffic at 0 dB this preset reads 0 false activations / 3 of 3 utterances / 0 % stuck-open, and it held 0 false client activations in a live Gemini session streaming 0 dB traffic. See the hardening chapter for the full study.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for VadConfig
impl RefUnwindSafe for VadConfig
impl Send for VadConfig
impl Sync for VadConfig
impl Unpin for VadConfig
impl UnwindSafe for VadConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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].