SMOODEV-2668: Fix browser-voice TTS static (frame alignment + proper resampling)#37
Merged
Merged
Conversation
…ate resampling, drain priming The wire is one continuous 16 kHz linear16 byte stream but frames split at arbitrary TCP boundaries: an odd-length frame threw on the Int16Array view (chunk dropped) and left every following frame decoding one byte off — loud white noise until parity restored. Carry the dangling byte across frames. Also stop forcing a 16 kHz AudioContext: the browser's context→hardware resampling mirrored speech energy above 8 kHz (imaging static). Run the context at its native rate and upsample with a stateful windowed-sinc interpolator that is seamless across chunk boundaries. Prime playback 100 ms off the playhead when the queue has drained so just-in-time chunks don't butt the playhead and click. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tz7j9eqPBBL36CEFZpjoWz
🦋 Changeset detectedLatest commit: 69c781e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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
The Chakra Transformation Posture voice pilot plays TTS with heavy static. Spectral analysis of a session recording showed three artifact classes:
new Int16Array(chunk)(dropped → gap) and left every subsequent frame decoding one byte off (high/low bytes of adjacent samples paired) until parity restored.AudioContext({sampleRate: 16000})leaves the 16k→hardware conversion to the browser's output resampler, which images.Solution
Server-side counterpart (even-byte frame alignment at the source + suggestedNextActions JSON strip) lands in the monorepo under the same ticket.
Verification
pnpm checkgreen (typecheck + test + build).🤖 Generated with Claude Code
https://claude.ai/code/session_01Tz7j9eqPBBL36CEFZpjoWz