Skip to main content

Crate rustvani_vad

Crate rustvani_vad 

Source
Expand description

§rustvani-vad

Pure Rust Silero VAD with bundled weights — zero external runtime dependencies.

SIMD-accelerated (AVX2+FMA on x86_64), ~90% less memory than Python Pipecat.

§Quick start

use rustvani_vad::{SileroVad, StateMachine, VadParams, VadState};

// Inference engine (weights are compiled in — nothing to download)
let vad = SileroVad::new()?;

// State machine for stream processing
let mut sm = StateMachine::new(16000, VadParams::default());

// Feed audio chunks in a loop
for chunk in audio_chunks {
    if let Some(window) = sm.next_window(&chunk) {
        let confidence = vad.infer(&window)?;
        match sm.advance(confidence, &window) {
            VadState::Speaking => { /* user is talking */ }
            VadState::Quiet    => { /* silence */ }
            _ => {}
        }
    }
}

§Async (requires tokio feature)

let confidence = vad.infer_async(window).await?;

Structs§

SileroVad
Pure Rust Silero VAD — no ONNX runtime, bundled weights.
StateMachine
Stateful VAD state machine.
VadParams
Parameters controlling VAD sensitivity and timing.

Enums§

VadState
Voice Activity Detection states.

Constants§

BYTES_PER_WINDOW
Number of bytes per inference window (512 samples × 2 bytes/sample).
SAMPLES_PER_WINDOW
Number of PCM samples per inference window at 16 kHz.

Functions§

calculate_audio_volume
Calculate audio volume as a normalised 0.0–1.0 value (dBFS-based).
exp_smoothing
Exponential smoothing: current × factor + prev × (1 - factor).