Skip to content

Add streaming Silero VAD runner for real-time speech detection#18507

Open
seyeong-han wants to merge 1 commit intopytorch:mainfrom
seyeong-han:silero-vad/streaming-runner
Open

Add streaming Silero VAD runner for real-time speech detection#18507
seyeong-han wants to merge 1 commit intopytorch:mainfrom
seyeong-han:silero-vad/streaming-runner

Conversation

@seyeong-han
Copy link
Contributor

Summary

Add a streaming CLI entry point (silero_vad_stream_runner) for the Silero VAD model that enables real-time, frame-by-frame voice activity detection from stdin. This powers the "hey torch" wake-up feature in the Voxtral Realtime macOS app.

Changes

New: silero_vad_stream_runner

A CLI that reads 16kHz mono float32 PCM from stdin and outputs per-frame speech probabilities via a line protocol:

READY
PROB 0.032 0.039
PROB 0.064 0.808
PROB 0.096 0.980

This enables any app to run Silero VAD as a subprocess — pipe audio in, parse probabilities out. The Voxtral macOS app uses this for hands-free wake-up detection.

New: Streaming API on SileroVadRunner

  • reset_stream() — re-initialize LSTM state and context buffers
  • process_frame(audio_data, num_samples) — process a single 512-sample chunk, return speech probability, carry LSTM state forward

The existing detect() method now uses process_frame() internally, so offline and streaming paths share the same inference code.

Build changes

  • CMakeLists.txt — add silero_vad_stream_runner target alongside silero_vad_runner
  • Remove unnecessary extension_llm_runner link dependency that caused string_view ambiguity with sentencepiece headers
  • Makefile silero-vad-cpu target — build both runners, configure with -DEXECUTORCH_BUILD_EXTENSION_LLM_RUNNER=OFF
  • README.md — document streaming usage, architecture, and line protocol

Usage

# Build
make silero-vad-cpu

# Run on a file
ffmpeg -i input.wav -ar 16000 -ac 1 -f f32le pipe:1 | \
  ./cmake-out/examples/models/silero_vad/silero_vad_stream_runner \
    --model_path silero_vad.pte

# Run on live mic
ffmpeg -f avfoundation -i ":0" -ar 16000 -ac 1 -f f32le pipe:1 | \
  ./cmake-out/examples/models/silero_vad/silero_vad_stream_runner \
    --model_path silero_vad.pte

Test plan

  • make silero-vad-cpu builds both silero_vad_runner and silero_vad_stream_runner
  • Offline runner produces same results as before on test WAV files
  • Stream runner on saved audio produces correct speech probabilities (0.8-1.0 on speech, <0.01 on silence)
  • Stream runner on live mic input detects speech in real-time
  • Integration tested with Voxtral Realtime macOS app wake-up flow

Authored with assistance from Claude.

Made with Cursor

Add a new `silero_vad_stream_runner` CLI that reads 16kHz mono
float32 PCM from stdin and outputs per-frame speech probabilities
via a simple line protocol (`PROB <time> <probability>`). This
enables real-time VAD as a subprocess for apps like the Voxtral
Realtime macOS dictation app.

Changes:
- Add `reset_stream()` and `process_frame()` to SileroVadRunner
  for stateful frame-by-frame inference with persistent LSTM state
- Add `stream_main.cpp` as the streaming CLI entry point
- Update CMakeLists.txt to build both `silero_vad_runner` (offline)
  and `silero_vad_stream_runner` (streaming) targets
- Remove unnecessary `extension_llm_runner` dependency that caused
  build conflicts with sentencepiece headers
- Update Makefile `silero-vad-cpu` target to build both runners
  with `-DEXECUTORCH_BUILD_EXTENSION_LLM_RUNNER=OFF`
- Update README with streaming usage and architecture docs

Authored with assistance from Claude.

Made-with: Cursor
@pytorch-bot
Copy link

pytorch-bot bot commented Mar 25, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/18507

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

⚠️ 11 Awaiting Approval

As of commit 42d253b with merge base 5ae3bf2 (image):

AWAITING APPROVAL - The following workflows need approval before CI can run:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 25, 2026
@github-actions
Copy link

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants