Repository navigation
fix(speech): language ID minSpeechMs counts voiced speech, not trailing silence - #300
Merged
Merged
Conversation
…ng silence The LID gate compared minSpeechMs with the buffered audio length, which includes the endpoint tail, so a short utterance followed by silence passed the threshold. Count VAD speech from the first to the last voiced frame (gaps between words count, trailing silence does not). The classifier still receives the whole buffer. The language-id example threshold is retuned to speech units. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
Symptom: a ~1 s utterance followed by silence passed a 1500 ms
languageId.minSpeechMsthreshold, so language ID ran on audio that was mostly silence.Cause: both threshold checks (the early/continuous check and the identify gate) compared
minSpeechMswith the length of the LID PCM buffer. That buffer runs from utterance start to close and includes the endpoint tail and STT gate hold after VAD speech end, so trailing silence counted as speech.Change:
lid_voiced_ms: speech from the first to the last voiced VAD frame of the utterance. Gaps between words count (they are folded in once speech resumes). Silence after the last voiced frame never counts.too_shortskip uselid_voiced_ms. The classifier still receives the whole buffered audio. Agents without a VAD treat every frame as voiced.forcesemantics, the continuous re-identify cadence and the defaults are unchanged.roundtrip-language-idexample threshold is retuned to speech units (2000 ms, a gate only under the default end-of-utterance timing).LanguageIdConfig.minSpeechMs, VOICE-API.md) and CHANGELOG updated.Tests (
crates/speech/tests/language_id_nonblocking_test.rs):early_timing_short_speech_with_long_trailing_silence_is_too_shortend_of_utterance_timing_short_speech_with_trailing_silence_is_too_shortearly_timing_identifies_once_voiced_reaches_minpauses_between_words_count_trailing_silence_does_notearly_timing_does_not_identify_during_trailing_silenceVerified locally and via CI; no extra manual steps.
🤖 Generated with Claude Code