| Crates.io | vad-silero-rs |
| lib.rs | vad-silero-rs |
| version | 0.1.5 |
| created_at | 2025-10-18 18:26:19.077957+00 |
| updated_at | 2025-10-18 18:26:19.077957+00 |
| description | Rust implementation of speech detection using Silero VAD |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1889507 |
| size | 48,253 |
A high-performance Rust implementation of the Silero Voice Activity Detection (VAD) model, optimized for real-time audio processing and integration into Rust-based applications. This project aims to provide an efficient and reliable solution for detecting speech segments in audio streams.
Add vad-silero-rs to your Cargo.toml file:
[dependencies]
vad-silero-rs = "0.1.0" # Use the latest version
Or, if you prefer to clone the repository and build from source:
git clone https://github.com/EliFuzz/vad-silero-rs.git
cd vad-silero-rs
cargo build --release
The library provides a straightforward interface to initialize the VAD model and process audio chunks.
Here's a quick example demonstrating how to use vad-silero-rs to detect voice activity in an audio buffer:
use vad_silero_rs::{VadNode, SampleRate, VADProbabilities};
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Initialize the VAD model with a specific sample rate.
// Ensure your audio input matches this sample rate.
let mut vad = VadNode::new(SampleRate::Rate16k)?;
// Example audio chunk (replace with your actual audio data)
// This should be a flattened array of f32 samples.
// For a real application, you would load audio from a file or microphone.
let audio_chunk: Vec<f32> = vec![0.0; 1024]; // 1024 samples of silence
// Process the audio chunk
let probabilities: VADProbabilities = vad.process_audio_chunk(&audio_chunk)?;
println!("Voice probability: {}", probabilities.speech_probability);
println!("Silence probability: {}", probabilities.silence_probability);
if probabilities.is_speech() {
println!("Speech detected!");
} else {
println!("Silence detected.");
}
Ok(())
}
This project is licensed under the Apache 2.0 License.