Conversation
…ixes #19) Add two-layer silence detection to prevent Whisper models from hallucinating random multi-language text when given silent audio: 1. Client-side energy gate: check pre-gain peak RMS against a threshold before sending audio to cloud APIs. Skips transcription entirely when no speech energy is detected. 2. Server-side no_speech_prob filter: parse the no_speech_prob field from verbose_json Whisper API responses (OpenAI, Groq, OpenAI Compatible) and discard results where all segments report high non-speech probability (> 0.8).
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
Fixes #19. Certain Whisper models (Large V3 Turbo, GPT-4o Transcribe) hallucinate random multi-language text when given silent audio. This adds two layers of silence detection:
no_speech_probfilter (post-filter): Parses theno_speech_probfield fromverbose_jsonWhisper API responses (OpenAI whisper-1, Groq, OpenAI Compatible). If all segments report > 0.8 non-speech probability, the result is discarded as a hallucination.Both filters apply to the final transcription path (
ProcessSingleJobAsync) and the live polling fallback (RunPollingFallbackAsync). WebSocket streaming providers (Deepgram, AssemblyAI) handle silence server-side and are unaffected.Test plan