ALL INTELLIGENCE
Hacker News AIT2·Tools

RealtimeVAD Open Source Detects End of Speech 110ms Earlier

Original title: Show HN: RealtimeVAD – trading false positives for 110ms earlier end-of-speech
62AI Score

RealtimeVAD is an open-source voice activity detection tool that keeps Silero VAD for speech boundaries while adding a 10ms audio-level check against room noise and speaker level, firing end-of-speech events roughly 110ms earlier than Silero. It trades a small number of false positives for lower end-to-end latency in voice assistants and real-time transcription, and ships with a LiveKit plugin and benchmark script.

Full Report

Contents6 sections

RealtimeVAD

Know that the speaker stopped, about 100 ms before Silero does.

RealtimeSTT · RealtimeTTS · Live demo · Spec · LiveKit plugin

A voice assistant can't do anything until it knows the user has stopped talking. Speech recognition, the LLM call and the voice output all wait for that one decision, and a normal voice activity detector takes a few hundred milliseconds to make it.

RealtimeVAD makes it sooner. It keeps Silero VAD to decide what is speech, and adds a second, faster check: every 10 ms it compares the audio level with the room's noise and with the speaker's own level. The moment the audio goes quiet, you get an event, long before Silero's probability has fallen.

  • Input: 16 kHz mono audio in chunks of any size (float32, int16 or int16 bytes).
  • Output: start, pause and end events, plus the audio of the running segment at any time.
  • Lead: speech-off a median 100 ms before Silero's probability drops, and 206 ms before Silero's VADIterator reports the end, on 3,279 real turns. The end itself comes before Silero's in 82 % of turns, by a median 70 ms.
  • Price: it also fires in short gaps between words, about ten times as often as Silero.
  • Quiet input: a quiet speaker's soft word endings are not silence; on a noisy quiet line the lead is gone instead (details).
  • Runs on: one CPU thread, far faster than realtime. Needs only numpy and onnxruntime; the Silero model is bundled, no torch.
  • Status: alpha (0.0.5). The API may still change.

Live demo

https://github.com/user-attachments/assets/d01900dd-9601-4f3d-8c88-db55e8bc83a1

The video uses a synthetic voice and shows a median lead of 92 ms. The 100 ms above is the median on real voice-assistant turns.

demo/ runs this page on your own microphone. It shows, turn by turn, how much sooner RealtimeVAD knew that you stopped than Silero alone, on the same audio.

Quick start

BASH
pip install realtimevad
PYTHON
from RealtimeVAD import VAD

vad = VAD()
for chunk in microphone_chunks():
    for event in vad.feed(chunk):
        if event.kind == "start":
            stream_to_asr(vad.audio())       # includes the audio just before speech began
        elif event.kind == "pause":
            speculate(vad.audio())           # the speaker may be done; this isn't the end yet
        elif event.kind == "end":
            finalize(event.segment.audio)

Events

EventMeaningWhen
startSpeech has begunAfter about 64 ms of confident speech, so clicks don't trigger it. Speech Silero is never confident about (a short "mm-hmm", a quiet phone voice) starts after about 0.13 s at half confidence, if it is clearly louder than the room
pauseThe speaker may have stopped (speech-off)Within about 10 ms of the audio going quiet
endThe segment is over0.24 s after speech-off, unless speech resumes. Never later than Silero alone
onsetSpeech may have begunAt the first confident frame, before start confirms it. Off by default: VAD(onset_events=True)

vad.audio() returns the running segment at any time, starting about 0.3 s before the speech. end carries the finished segment with its audio, start time, end time and the time the speech stopped.

If your assistant talks while the microphone is open, pass vad.feed(chunk, playback=True) for those chunks so its own voice is handled as possible echo. Every threshold and duration can be configured; SPEC.md lists what is guaranteed.

How to use pause

pause is early and often wrong, on purpose. It fires on every breath, every short gap between words and every stop consonant, so most pause events are followed by more speech.

  • Use it to start work you can cancel: finalize the transcript, call the LLM, prepare the voice output. Cancel when speech continues. A wrong pause then costs almost nothing, and a right one saves hundreds of milliseconds.
  • Never treat it as the end of the turn. Only end closes a segment.
  • Can't cancel quickly? Ignore pause and wait for end. The extra false alarms would cost you more than they save.

Already using Silero?

Change the import:

PYTHON
from silero_vad import load_silero_vad
from RealtimeVAD import VADIterator          # was: from silero_vad import VADIterator

vad_iterator = VADIterator(load_silero_vad(), sampling_rate=16000)
speech_dict = vad_iterator(chunk, return_seconds=True)   # {'start': ...} / {'end': ...} / None

The constructor and the results stay the same, but end arrives as soon as the audio goes quiet. Without a model argument, it uses the bundled Silero model and doesn't need torch.

Using LiveKit Agents?

livekit-plugins-realtimevad/ is a VAD plugin: realtimevad.VAD.load() in place of silero.VAD.load(). Its README shows how the events map and what it measured against the Silero plugin on the same audio. In short: against the Silero plugin's defaults the end of speech comes about 380 ms sooner, but most of that is the shorter silence setting (0.25 s instead of 0.55 s), which Silero can be given too. At the same setting RealtimeVAD's end is 65 to 110 ms earlier, and LiveKit's turn detector starts 95 to 180 ms earlier. Inside a LiveKit session the turn was committed about 150 ms sooner than with Silero's defaults and about 70 ms sooner than with Silero at 0.25 s.

(注:更多技术实现细节与完整 API 文档请查阅原项目 README)


作者发帖说明(HN):

Hey guys. I recently watched the latency reports for my local voice assistant, which show a waveform plus silero probability for voice activity. I noticed silero lags visibly on the speech off signal.

There had to be a method to get this signal closer to what I felt is optimal. My idea was to use a 10 ms energy detector with a threshold that adapts to environment or room noise. Which worked amazingly well. It created more false positives but in my speculative generation pipeline that would not matter. If it's wrong and the user continues speaking I can abort the pipeline fast.

I benchmarked my solution over ~3200 turns from my assistant logs and it came out ~110 ms faster initially. Still 100 ms now after some a fix which was needed for quiet speech.

I made it public if you want to have a look. If you measure it on your data I really appreciate any feedback. There's a benchmark script in the repo.

Thx for reading, have a good day folks.