Skip to content

fix(google): pin MP3 output to 24 kHz - #12

Merged
willwade merged 1 commit into
mainfrom
fix/google-sample-rate-pin
Aug 16, 2026
Merged

fix(google): pin MP3 output to 24 kHz#12
willwade merged 1 commit into
mainfrom
fix/google-sample-rate-pin

Conversation

@willwade

Copy link
Copy Markdown
Contributor

Why

Without sampleRateHertz Google returns audio at each voice's natural rate (22050/24000/32000 depending on model family), so downstream consumers that receive bare PCM via on_audio cannot know the rate — VoiceGarden-SPD had to guess and would play some voices at the wrong speed.

What

One-line pin: audioConfig.sampleRateHertz = 24000 alongside the existing MP3 encoding, making the decoded PCM rate deterministic for every voice. (Verified against the live API: voices list naturalSampleRateHertz of 22050/24000/32000, so the pin genuinely changes output for some voices.)

Cherry-picked from the feat/vgspd-integration integration branch where it was originally committed.

Without sampleRateHertz Google returns audio at each voice's natural
rate (22050/24000/32000 depending on model family), so downstream
consumers that receive bare PCM via on_audio cannot know the rate.
Pinning 24000 makes the delivery rate deterministic for every voice.
@willwade
willwade merged commit 73201e1 into main Aug 16, 2026
9 checks passed
@willwade
willwade deleted the fix/google-sample-rate-pin branch August 16, 2026 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant