Repository navigation
Commit server_vad turns once silence_duration_ms has followed the speech, padding regions in the tools - #232
Merged
Merged
Conversation
…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>
This was referenced Nov 21, 2026
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>
This was referenced Nov 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Transcription by regions (
speech asr --vad,chunking_strategy, andserver_vadon/v1/realtimeand inspeech asr -/--live) now pads the speech the detection finds itself, as OpenAI's reference describes aserver_vadturn, instead of taking Silero VAD's padded regions:speech_pad_ms0 and finds the speech alone.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 thanmin_silence_duration_ms(silence_duration_ms), so that its audio is all there once the silence that ends it has passed.max_speech_duration_scut 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.max_speech_duration_sless 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).RegionCutintools/common/regions.cppis the one place the rule lives; the server's transcriptions,speech asr --vadand 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_mshalf 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_ms300,silence_duration_ms500) an utterance was committed 600 ms after its speech, not 500, and a client that setsilence_duration_msbelow twiceprefix_padding_msgot no sooner commit at all. Now the commit comes oncesilence_duration_mshas 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/realtimewithserver_vad,speech asr -andspeech asr --livecommit each utterance 100 ms sooner with the defaults, and as much sooner assilence_duration_msis shortened below twiceprefix_padding_ms.speech vadis unchanged: it keeps Silero VAD's own regions and padding.Measured
measure/live_latency.pyon 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/realtimewithserver_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: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.pywith 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.pywith 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.pyandserver_diarization_smoke.pywith Qwen3-ASR 0.6B and Silero VAD (and Nemotron 3 Diarization Q8_0),server_enhancement_smoke.pywith RE-USE,server_dialogue_smoke.pywith Haru 4B Q8_0,server_page_smoke.pywith Qwen3-TTS 0.6B, Qwen3-ASR 0.6B and 1.7B and Silero VAD, andspeech_cli_smoke.pywith 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_msis 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
🤖 Generated with Claude Code