Silero VAD V5
Critical implementation details for the Silero VAD V5 ONNX model used in Open Mic mode. They were found by debugging in April 2026 and are not well documented upstream.Model source
- Upstream: snakers4/silero-vad, version V5.
- Bundled file:
src-tauri/resources/silero_vad.onnx, included at compile time withinclude_bytes!insrc-tauri/src/vad.rs. - The implementation is self-written on top of
ort, to avoid dependency version conflicts.
ONNX interface: V5 versus V4
V5 changed the ONNX tensor names. Using the V4 names producesInvalid input name: "h" on every inference, and the probability comes back as 0.0.
Both a scalar
sr (shape []) and an array sr (shape [1]) are accepted.
Chunk size: use 256 samples
The model’s ONNX graph has conditionalIf nodes that branch on chunk size. With 512-sample chunks the LSTM state accumulates the wrong dimensions after the first prediction:
- the LSTM expects
{1, 1, 128}(3 dimensions) - after a 512-sample chunk it holds
{1, 1, 128, 2}(4 dimensions)
Input X must have 3 dimensions only. The failure is swallowed and the model returns a probability of about 0.0006 for every input, whatever the audio.
Results for the same audio at different chunk sizes:
Both the bundled model and the official model downloaded from GitHub behave the same way. A likely cause is an ORT 1.23 or newer incompatibility with the model’s
If node structure at chunk sizes other than 256. This is why echo_audio::capture hands the VAD state machine 256-sample chunks.
Normalizing quiet sources
WSLg’sRDPSource captures at very low levels (about -38 dB, peak around 0.01). Normal speech peaks at 0.1 to 0.5. Whisper normalizes internally, but Silero VAD expects normal amplitude.
Before vad.predict(), the recorder scales each chunk toward a 0.5 peak, with the gain capped at 100x so noise is not amplified without limit, and leaves chunks at the noise floor unchanged (VAD_NORMALIZE_MIN_PEAK in src-tauri/src/audio/recorder.rs). The raw, unnormalized buffer is what gets transcribed. A periodic idle reset keeps the LSTM state from drifting on amplified noise.
State management
- Reset between recording sessions (
vad.reset()zeroes the[2, 1, 128]state tensor). - Do not reset between chunks within a session; the state carries across chunks.
- After a completed speech segment is emitted (
open-mic-chunk-ready), reset for the next utterance.
Detection settings
- The threshold decides speech or non-speech per chunk (
probability >= threshold). - The silence timeout is how long silence must last after speech before transcription is triggered.
- Minimum speech duration is measured in wall-clock time from speech onset; anything shorter is treated as noise and discarded.
Key files
src-tauri/src/vad.rs-SileroVad, theVadBackendtrait, predict and resetsrc-tauri/src/audio/recorder.rs- VAD recording loop, state machine, bufferssrc-tauri/src/commands/recording.rs- Tauri commands and the RMS silence guardsrc-tauri/resources/silero_vad.onnx- the model
Debugging
OPEN_MIC_DEBUG in src-tauri/src/audio/recorder.rs is cfg!(debug_assertions), so per-frame logging is on in debug builds and off in release builds: