Skip to content

Commit server_vad turns once silence_duration_ms has followed the speech, padding regions in the tools - #232

Merged
nyosegawa merged 3 commits into
mainfrom
server-vad-commits-at-silence
Nov 21, 2026
Merged

nyosegawa merged 3 commits into
mainfrom
server-vad-commits-at-silence

Conversation

@nyosegawa

@nyosegawa nyosegawa commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

What changed

Transcription by regions (speech asr --vad, chunking_strategy, and server_vad on /v1/realtime and in speech asr - / --live) now pads the speech the detection finds itself, as OpenAI's reference describes a server_vad turn, instead of taking Silero VAD's padded regions:

  • The detection runs with speech_pad_ms 0 and finds the speech alone.
  • A region keeps speech_pad_ms (prefix_padding_ms) before its speech, but not before the region before it ends, and as much after it, but no more than min_silence_duration_ms (silence_duration_ms), so that its audio is all there once the silence that ends it has passed.
  • Where max_speech_duration_s cut the speech and the speech after it starts within that silence, the region ends halfway to it if that comes first. A stream holds such a region until the speech after it has begun or the silence has passed, so that its padding is the one a file gets.
  • The detection's longest region is max_speech_duration_s less the padding, so that a padded region is no longer than before. A padding that leaves no room for speech in the longest region is refused (invalid_argument, speech_pad_ms / prefix_padding_ms).

RegionCut in tools/common/regions.cpp is the one place the rule lives; the server's transcriptions, speech asr --vad and the assembly of utterances all use it, so a file and the same audio streamed still give the same regions and texts.

Why

Silero VAD gives two regions closer than twice speech_pad_ms half the silence between them, so a stream knew a region's end only once that much silence had passed: with OpenAI's defaults (prefix_padding_ms 300, silence_duration_ms 500) an utterance was committed 600 ms after its speech, not 500, and a client that set silence_duration_ms below twice prefix_padding_ms got no sooner commit at all. Now the commit comes once silence_duration_ms has passed, as the reference describes it. This came up in #230, which asked for the completion to come sooner after the speech ends.

What changes for users

  • /v1/realtime with server_vad, speech asr - and speech asr --live commit each utterance 100 ms sooner with the defaults, and as much sooner as silence_duration_ms is shortened below twice prefix_padding_ms.
  • Regions closer together than twice the padding split the silence between them differently (the earlier one keeps its padding, the later one starts no earlier than it ends), so their texts can differ slightly from 0.11.1's. Regions further apart are the same.
  • speech vad is unchanged: it keeps Silero VAD's own regions and padding.

Measured

measure/live_latency.py on an Apple M5 (2026-11-22): FLEURS ja_jp and en_us test clips, two sessions of five clips per language in each of two rounds, over /v1/realtime with server_vad's defaults in pieces of 100 ms in real time, Qwen3-ASR Q8_0 on Metal and Silero VAD on the CPU. Utterances the detection did not cut, p50 / p90 in seconds from the end of speech:

0.11.0 this PR
commit 0.67–0.69 / 0.70–0.94 0.58–0.60 / 0.64–0.68
completed, 0.6B en 0.80 / 1.00 0.69 / 0.82
completed, 0.6B ja 0.79 / 0.84 0.73 / 0.83
completed, 1.7B en 0.96 / 1.08 0.85 / 1.01
completed, 1.7B ja 1.00 / 1.16 0.84 / 0.98

Every completed transcript (58 per model and build) was the recognition of the same samples sent as a file. Peak memory unchanged.

Checked

  • Build on macOS (Apple M5).

  • checks/smoke/server_realtime_smoke.py with Qwen3-ASR 0.6B Q8_0 and Silero VAD: pass. Its new check, that every utterance of a dump is committed with 580 ms of audio after its last speech, fails on 0.11.0 (which commits after 600 ms) and passes here.

  • checks/smoke/speech_cli_smoke.py with Qwen3-ASR 0.6B and Silero VAD: pass, now also with a longest region of 2 s, which cut the speech 12 times within speech and 5 times at a pause; the file and the stream gave the same 18 regions and texts.

  • server_smoke.py and server_diarization_smoke.py with Qwen3-ASR 0.6B and Silero VAD (and Nemotron 3 Diarization Q8_0), server_enhancement_smoke.py with RE-USE, server_dialogue_smoke.py with Haru 4B Q8_0, server_page_smoke.py with Qwen3-TTS 0.6B, Qwen3-ASR 0.6B and 1.7B and Silero VAD, and speech_cli_smoke.py with reazonspeech-nemo-v2 F32 and Silero VAD: pass.

  • Codex's review found that a region cut within its speech was padded by the start of the region under way after it even while that region was not yet kept; a stretch shorter than min_speech_duration_ms is dropped, so the file padded it otherwise. Fixed (the region waits until that speech is kept or dropped), with a CLI smoke case fed in pieces of 20 ms that fails without the fix (the stream ended the region at 3.632 s, the file at 3.916 s) and passes with it.

Not checked

  • Windows / Vulkan: the change is in the tools' CPU code alone.

🤖 Generated with Claude Code

nyosegawa and others added 3 commits November 22, 2026 04:14
…ech, padding regions in the tools

Transcription by regions took Silero VAD's padded regions, which give two regions closer than twice
speech_pad_ms half the silence between them, so a stream knew a region's end only once that much
silence had passed: with OpenAI's defaults an utterance was committed 600 ms after its speech rather
than the 500 ms silence_duration_ms says, and a silence_duration_ms below twice prefix_padding_ms
gave no sooner commit at all.

The detection now finds the speech alone (speech_pad_ms 0), and RegionCut in tools/common pads it:
speech_pad_ms before the speech, but not before the region before it ends, and as much after it,
but no more than min_silence_duration_ms, so that a region's audio is all there once the silence
that ends it has passed. Where max_speech_duration_s cut the speech and the speech after it starts
within that silence, the region ends halfway to it if that comes first; a stream holds such a
region until it knows which. The detection's longest region is max_speech_duration_s less the
padding. The server's transcriptions, speech asr --vad and the assembly of utterances all cut with
RegionCut, so a file and the same audio streamed keep giving the same regions and texts.
speech vad keeps Silero VAD's own regions.

Checked: server_realtime_smoke.py, speech_cli_smoke.py, server_smoke.py and
server_diarization_smoke.py with Qwen3-ASR 0.6B Q8_0 and Silero VAD on an Apple M5 pass. The
realtime smoke's new check, that a dump's utterances are all committed with 580 ms of audio after
its last speech, fails on 0.11.0 and passes here; the CLI smoke now also compares a file and the
same audio streamed with a longest region of 2 s, which cut the speech 12 times within speech and 5
times at a pause.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Where max_speech_duration_s cut the speech within it, the assembly padded the region by the start of
the region under way even while that region was not yet kept. A stretch shorter than
min_speech_duration_ms is then dropped, and the file, in which it is no region, pads the cut region
by after() instead: streamed in pieces of 20 ms, a region cut at 3.616 s ended at 3.632 s, where the
file ends it at 3.916 s. The region now waits until the speech after it is kept, dropped, or more
than the silence away.

Checked: the CLI smoke's new case, a region cut within its speech followed by 150 ms of speech and a
second of silence, fed to speech asr - in pieces of 20 ms, fails without the fix and passes with
it; speech_cli_smoke.py and server_realtime_smoke.py with Qwen3-ASR 0.6B and Silero VAD pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
measure/live_latency.py on an Apple M5 with FLEURS ja and en over /v1/realtime: the commit came
0.58 to 0.60 s after the speech ended in the median, where Silero VAD's padding gave 0.67 to 0.69 s,
and the completed transcript 0.69 to 0.73 s with Qwen3-ASR 0.6B and 0.84 to 0.85 s with 1.7B, where
it came 0.79 to 0.80 s and 0.96 to 1.00 s. Every completed transcript was the recognition of the
same samples sent as a file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nyosegawa
nyosegawa merged commit 8ccc4b7 into main Nov 21, 2026
8 checks passed
nyosegawa added a commit that referenced this pull request Nov 21, 2026
…_ms has passed and recognized while that silence goes on (#234)

VERSION is 0.11.2, and the docs that name the version say so: speech --version (now with C API
4.3), the notice of a newer release, speech_version() and the worker's ready.

0.11.2 carries #232, which pads the regions of transcription by regions in the tools so that an
utterance is committed once silence_duration_ms of silence has followed its speech (500 ms with
OpenAI's defaults, where Silero VAD's padding waited 600 ms), and #233, which adds
speech_detection_ending() (C API 4.3) and reads an utterance to the end it would take while that
silence goes on, so that its commit completes with that reading. On an Apple M5 over /v1/realtime,
the median time from the end of speech to the completed transcript went from 0.79-0.80 s to
0.58-0.59 s with Qwen3-ASR 0.6B and from 0.96-1.00 s to 0.62-0.66 s with 1.7B.

Checked: no file other than VERSION and the four docs names the release or the C API's version.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@nyosegawa
nyosegawa deleted the server-vad-commits-at-silence branch November 21, 2026 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant