Repository navigation
fix(audio): write real sizes into non-streamed WAV headers - #587
Merged
Merged
Conversation
somaz94
added a commit
to somaz94/somaz94
that referenced
this pull request
Nov 5, 2026
remsky
requested changes
Nov 12, 2026
somaz94
force-pushed
the
fix/non-stream-wav-header-sizes
branch
from
November 13, 2026 01:47
bc26c4c to
9f2a49f
Compare
Owner
|
Thanks for the fix, merged in @somaz94 |
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.
Non-streamed WAV (
"stream": false) kept the streaming placeholder 0xFFFFFFFF in the RIFF and data chunk sizes, so readers that trust the header, like Python'swave, saw a one-sentence file as about 25 hours long.StreamingAudioWriterreads the buffer before the container closes on purpose, since a stream cannot know its final length, andgenerate_audiojoined those chunks as they were. Once the chunks are joined the length is known, sogenerate_audionow writes the real RIFF size and walks the chunks todata(ffmpeg puts a LIST chunk before it, so it is not at offset 36) to write its size too. Streaming responses are unchanged. The non-stream branch of/v1/audio/speech, its download link and/dev/captioned_speechall go throughgenerate_audio, so all three get the fix.The new test feeds real
StreamingAudioWriterWAV chunks throughgenerate_audioand checks the RIFF size andwave.getnframes(). It failed before the change with a RIFF size of 4294967295.uv run pytestgives 669 passed and 9 skipped,ruff check .passes, and the changed files are formatted. I used Claude Code to help trace this and write the change, and I reviewed and tested it myself.Closes #586
Testing
uv run pytestpasses locally (API changes)npm run test:webpasses locally (web player changes)npm run cpu:up/gpu:up), for inference or docker changesCHANGELOG.mdentry, if users will notice the change