<div align="center">
<h1>silero</h1>
</div>
<div align="center">
Production-oriented Rust wrapper for the Silero VAD ONNX model.
[<img alt="github" src="https://img.shields.io/badge/github-findit--ai/silero-8da0cb?style=for-the-badge&logo=Github" height="22">][Github-url]
<img alt="LoC" src="https://img.shields.io/endpoint?url=https%3A%2F%2Fgist.githubusercontent.com%2Fal8n%2F327b2a8aef9003246e45c6e47fe63937%2Fraw%2Fsilero" height="22">
[<img alt="Build" src="https://img.shields.io/github/actions/workflow/status/findit-ai/silero/ci.yml?logo=Github-Actions&style=for-the-badge" height="22">][CI-url]
[<img alt="codecov" src="https://img.shields.io/codecov/c/gh/findit-ai/silero?style=for-the-badge&token=6R3QFWRWHL&logo=codecov" height="22">][codecov-url]
[<img alt="docs.rs" src="https://img.shields.io/badge/docs.rs-silero-66c2a5?style=for-the-badge&labelColor=555555&logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDUxMiA1MTIiPjxwYXRoIGZpbGw9IiNmNWY1ZjUiIGQ9Ik00ODguNiAyNTAuMkwzOTIgMjE0VjEwNS41YzAtMTUtOS4zLTI4LjQtMjMuNC0zMy43bC0xMDAtMzcuNWMtOC4xLTMuMS0xNy4xLTMuMS0yNS4zIDBsLTEwMCAzNy41Yy0xNC4xIDUuMy0yMy40IDE4LjctMjMuNCAzMy43VjIxNGwtOTYuNiAzNi4yQzkuMyAyNTUuNSAwIDI2OC45IDAgMjgzLjlWMzk0YzAgMTMuNiA3LjcgMjYuMSAxOS45IDMyLjJsMTAwIDUwYzEwLjEgNS4xIDIyLjEgNS4xIDMyLjIgMGwxMDMuOS01MiAxMDMuOSA1MmMxMC4xIDUuMSAyMi4xIDUuMSAzMi4yIDBsMTAwLTUwYzEyLjItNi4xIDE5LjktMTguNiAxOS45LTMyLjJWMjgzLjljMC0xNS05LjMtMjguNC0yMy40LTMzLjd6TTM1OCAyMTQuOGwtODUgMzEuOXYtNjguMmw4NS0zN3Y3My4zek0xNTQgMTA0LjFsMTAyLTM4LjIgMTAyIDM4LjJ2LjZsLTEwMiA0MS40LTEwMi00MS40di0uNnptODQgMjkxLjFsLTg1IDQyLjV2LTc5LjFsODUtMzguOHY3NS40em0wLTExMmwtMTAyIDQxLjQtMTAyLTQxLjR2LS42bDEwMi0zOC4yIDEwMiAzOC4ydi42em0yNDAgMTEybC04NSA0Mi41di03OS4xbDg1LTM4Ljh2NzUuNHptMC0xMTJsLTEwMiA0MS40LTEwMi00MS40di0uNmwxMDItMzguMiAxMDIgMzguMnYuNnoiPjwvcGF0aD48L3N2Zz4K" height="20">][doc-url]
[<img alt="crates.io" src="https://img.shields.io/crates/v/silero?style=for-the-badge&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pg0KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjAuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPg0KPHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJMYXllcl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCINCgkgdmlld0JveD0iMCAwIDUxMiA1MTIiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPGc+DQoJPGc+DQoJCTxwYXRoIGQ9Ik0yNTYsMEwzMS41MjgsMTEyLjIzNnYyODcuNTI4TDI1Niw1MTJsMjI0LjQ3Mi0xMTIuMjM2VjExMi4yMzZMMjU2LDB6IE0yMzQuMjc3LDQ1Mi41NjRMNzQuOTc0LDM3Mi45MTNWMTYwLjgxDQoJCQlsMTU5LjMwMyw3OS42NTFWNDUyLjU2NHogT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svg?style=for-the-badge" height="22">
</div>
## Introduction
Production-oriented Rust wrapper for the Silero VAD ONNX model.
This crate is designed around the way we actually run VAD in services:
- one reusable ONNX session per worker
- one small stream state per active audio stream
- one optional segmenter that turns frame probabilities into speech ranges
It intentionally does **not** own queueing, health checks, worker counts, or
ONNX thread policy. Those belong in a higher-level service crate.
## Model layout
Silero VAD is a stateful model:
- input audio: fixed-size 8 kHz or 16 kHz chunks
- rolling context: 32 samples at 8 kHz, 64 samples at 16 kHz
- recurrent memory: `state` / `stateN`
Because of that, the crate exposes three core building blocks:
- `Session`
- owns the ONNX Runtime session
- supports exact-chunk single inference and multi-stream batch inference
- `StreamState`
- owns per-stream model memory: recurrent state, rolling context, and tail buffer
- `SpeechSegmenter`
- turns frame probabilities into `SpeechSegment`s using hysteresis and timing rules
## Quick start
```rust
use silero::{Session, SpeechOptions, detect_speech};
fn main() -> Result<(), silero::Error> {
let model = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/models/silero_vad.onnx"));
let audio_16k: Vec<f32> = vec![0.0; 16_000];
let mut session = Session::from_memory(model)?;
let segments = detect_speech(&mut session, &audio_16k, SpeechOptions::default())?;
println!("detected {} speech segments", segments.len());
Ok(())
}
```
## Streaming usage
```rust
use silero::{Session, SpeechOptions, SpeechSegmenter, StreamState};
fn main() -> Result<(), silero::Error> {
let model = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/models/silero_vad.onnx"));
let mut session = Session::from_memory(model)?;
let config = SpeechOptions::default();
let mut stream = StreamState::new(config.sample_rate());
let mut segmenter = SpeechSegmenter::new(config.clone());
let audio_chunk = vec![0.0_f32; config.sample_rate().chunk_samples()];
segmenter.process_samples(&mut session, &mut stream, &audio_chunk, |segment| {
println!(
"speech {:.2}s -> {:.2}s",
segment.start_seconds(),
segment.end_seconds()
);
})?;
segmenter.finish_stream(&mut session, &mut stream, |segment| {
println!(
"speech {:.2}s -> {:.2}s",
segment.start_seconds(),
segment.end_seconds()
);
})?;
Ok(())
}
```
## Batch inference
Silero's batch dimension represents **independent streams at the same sample
rate**, not consecutive chunks from one stream.
```rust
use silero::{BatchInput, SampleRate, Session, StreamState};
let model = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/models/silero_vad.onnx"));
let mut session = Session::from_memory(model).unwrap();
let mut a = StreamState::new(SampleRate::Rate16k);
let mut b = StreamState::new(SampleRate::Rate16k);
let chunk_a = vec![0.0_f32; 512];
let chunk_b = vec![0.0_f32; 512];
let mut batch = [
BatchInput::new(&mut a, &chunk_a),
BatchInput::new(&mut b, &chunk_b),
];
let probabilities = session.infer_batch(&mut batch).unwrap();
assert_eq!(probabilities.len(), 2);
```
## Session construction
The crate bundles `models/silero_vad.onnx` and exposes:
- `Session::bundled()` when the `bundled` feature is enabled
- `Session::from_file(...)`
- `Session::from_memory(...)`
- `Session::from_ort_session(...)`
`SessionOptions` only contains model-local options such as graph optimization.
If a service needs to tune `intra_threads` / `inter_threads`, build the ORT
session at the service layer and pass it into `Session::from_ort_session(...)`.
## Notes
- Direct sample rates: 8 kHz and 16 kHz.
- The crate does not do audio decoding or resampling.
- `SpeechDetector` is kept as a type alias for `SpeechSegmenter`.
## Development
```bash
cargo fmt
cargo test
```
#### License
`silero` is under the terms of both the MIT license and the
Apache License (Version 2.0).
See [LICENSE-APACHE](LICENSE-APACHE), [LICENSE-MIT](LICENSE-MIT) for details.
Copyright (c) 2026 FinDIT studio authors.
#### Third-party model notice
This crate bundles and redistributes `models/silero_vad.onnx`, a Silero VAD model
from the upstream Silero project.
The bundled model is third-party content and remains subject to its upstream
license terms. The upstream Silero model is distributed under the MIT license,
and redistribution should retain the upstream copyright and permission notice.
See [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md) for the bundled model's
upstream sources, attribution, and MIT notice text.
[Github-url]: https://github.com/Findit-AI/silero
[CI-url]: https://github.com/Findit-AI/silero/actions/workflows/ci.yml
[codecov-url]: https://app.codecov.io/gh/Findit-AI/silero/
[doc-url]: https://docs.rs/silero
[crates-url]: https://crates.io/crates/silero