Repository navigation
Voice: end voiced audio cleanly; cut long summaries at a sentence - #92
Merged
Merged
Conversation
…ence - voice-audio rewrites the speech service's WAV as a canonical PCM file with real sizes (Kokoro streams 0xFFFFFFFF sizes and a LIST chunk) and appends trailing silence (400 ms, or pad_ms), so outputs that close the stream early keep the last word. - toSpokenText cuts an over-long summary at its last full sentence, and a character cut at a whole word, instead of mid-sentence. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 24 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (8)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Why
Reports of spoken summaries cutting off at the end. I fetched the same sentence from Chatterbox and Kokoro at 1.0 / 1.2 / 1.5× and measured: every clip already ends with 176–516 ms of silence, so the speech services are not truncating. But two things on our side can lose the ending:
0xFFFFFFFFand a LIST chunk precedes the data (78-byte header). Kokoro is the fallback whenever the GPU is busy, which is often. Players have to guess where it ends; the plugin's duration estimate assumes 44 bytes.Separately,
toSpokenTextcut an over-long summary at the word cap and appended "." mid-sentence, which sounds like an ending cut off too.What changed
services/wav.tsfinishWav: readsfmtanddata(whatever chunks come between), trusts the bytes actually present over a streamed size, and writes a canonical 44-byte PCM WAV with correct sizes plus trailing silence. Anything that is not 16-bit PCM RIFF/WAVE passes through untouched.voice-audioapplies it: 400 ms by default (VOICE.padMs), orpad_ms(0–1000). The plugin sends0for mid-speech pieces (DowLucas/devscope-plugin, 0.33.0), so long speech gains no extra pauses. Older plugins get padding on every piece, which is harmless.toSpokenText: over the word cap, it ends at the last full sentence if that keeps at least half; over the character cap, at a sentence or a whole word with "…", never mid-word.Testing
wav.test.ts: padding and sizes, a Kokoro-style streamed WAV with a LIST chunk, pad 0, a short body, non-PCM passthrough.voice.test.ts: default padding,pad_ms: 0, out-of-rangepad_msrejected.voiceSummary.test.ts: sentence-boundary cut, fallback word cut, character cut at a whole word.finishWavcome out with exact 0.4 s of added silence and are read correctly by Python's strictwavemodule.🤖 Generated with Claude Code