fix: recover empty short Whisper transcriptions - #255
Merged
Conversation
✅ Deploy Preview for voca-mac canceled.
|
|
| Filename | Overview |
|---|---|
| Sources/VocaMac/Services/WhisperService.swift | Configures the WhisperKit trailing exclusion window according to the input sample count. |
| Tests/VocaMacTests/WhisperServiceTests.swift | Adds boundary tests covering decode-loop eligibility and preservation of the longer-clip default. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Whisper audio samples] --> B{Sample count ≤ 16,000?}
B -->|Yes| C[Set windowClipTime to 0]
B -->|No| D[Keep one-second window]
C --> E[Run WhisperKit transcription]
D --> E
Reviews (2): Last reviewed commit: "fix: decode short Whisper clips without ..." | Re-trigger Greptile
Member
|
@Mr-Sunglasses thanks, this looks good. Merging. |
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.
Problem
WhisperKit defaults to excluding one second at the end of a decoding window. Its decode loop runs only while
seek < end - windowPadding, so recordings of one second or less never enter the loop and return empty text. A current-source Tiny reproduction returned empty for a 0.498-second synthetic “Hello” recording.Changes
Set
windowClipTimeto zero for clips of at most 16,000 samples (one second at 16 kHz). Longer clips retain WhisperKit's default trailing-window protection. Short speech is decoded directly using the original samples and duration, with no additional padding or retry. Existing vocabulary recovery and no-speech filtering remain in place.Validation
Hello.with their original durations.swift test;git diff --checkpassed.