use case · multi-model · Silero VAD v5 (2.2 MB CPU WASM · MIT) → Ultravox v0.5 Llama-3.2-1B (1,382.7 MB · MIT) · 1,384.9 MB pack

Silero VAD trims the silence before Ultravox listens

The Whisper encoder inside Ultravox pays for every 10 ms mel frame — silence included. A 2.2 MB voice activity detector on the CPU finds the speech first, the page stitches only the voiced segments together, and Ultravox encodes a shorter clip. Stage 1 keeps working even when WebGPU (and so Stage 2) is unavailable.

1 · Two isolated workers

Stage 1 · Silero VAD v5 (2.2 MB fp32 · CPU WASM · MIT)

onnx-community/silero-vad via the reused ../silero-vad/worker.js (onnxruntime-web 1.20.1).

Stage 2 · Ultravox v0.5 Llama-3.2-1B (1,382.7 MB · WebGPU + WASM encoder)

onnx-community/ultravox-v0_5-llama-3_2-1b-ONNX via ../worker.js (Transformers.js 4.3.2).

2 · Audio → VAD trim → Ultravox

Initialise the pack above (Stage 1 runs on any CPU; Stage 2 needs WebGPU).

Loading clip…

Raw clip with Silero VAD speech bands

VAD-trimmed clip sent to Ultravox

Run Stage 1 to trim.
Stage 1 VAD–
Silence removed–
Silent mel frames–
Audio tokens–
Encoder ms (raw → trimmed)–
NaN (S1 / S2)–
Raw versus VAD-trimmed Ultravox runs
Input Duration Mel frames (silent) Audio tokens Encoder ms TTFT Active frames Answer
Run the pipeline to compare raw and trimmed audio.

3 · Show the code

Show the code · ultravox-core.mjs — trimToSpeech() (stitch VAD segments)
Show the code · ultravox.js — SileroVadStageClient.detect() (reusing ../silero-vad/worker.js)