Repository navigation
speech: wav24, wav32f and FLAC replies, a sample_rate and stereo, each opt-in per request - #3138
Merged
Merged
Conversation
ashhart
force-pushed
the
lead/tts-formats
branch
from
November 14, 2026 03:28
9f1fdd8 to
cf3b825
Compare
5 of 8 tasks
8 tasks done
ashhart
force-pushed
the
lead/tts-formats
branch
3 times, most recently
from
November 21, 2026 22:51
1830c41 to
8367287
Compare
This was referenced Nov 22, 2026
…h opt-in per request response_format takes wav24 (24-bit PCM WAV), wav32f (float WAV carrying the take's samples bit for bit) and flac (16-bit FLAC with fixed-predictor subframes that decodes to the wav reply's samples); mp3, opus and aac are refused by name. sample_rate (one of twelve standard rates, so the resampling kernel stays small) resamples the take, and channels: 2 writes each sample on both channels. A request without them, or with the model's own rate and one channel, gets the same wav and pcm bytes as before through the same path; a stream stays 16-bit mono PCM at the model's rate. Drama 3's torchaudio-style resampler moves unchanged into core/audio.zig so the speech route can use it; drama3/wav.zig names it there, so reference clips resample as before.
…s left out on Windows like the stream test
ashhart
force-pushed
the
lead/tts-formats
branch
from
November 22, 2026 10:57
8367287 to
d055f5a
Compare
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.
response_formaton/v1/audio/speechaddswav24,wav32fandflac, with an optionalsample_rate(one of 12 standard rates) andchannels: 2. Defaultwavandpcmat the model's rate in mono go through the old code and stay byte-identical.mp3,opusandaacare refused by name.flac.zig, checked by a test decoder that verifies frame CRCs and the MD5, and by CoreAudio'safconvert, which decodes our FLAC (past 2,052 frames) to exactly the bytes of the 16-bit WAV reply.sample_rateis limited to standard rates: an arbitrary rate such as 44101 would build a multi-GB resampling kernel.core/audio.zigwith its function body unchanged, so drama3's error set and codes are unchanged.Tests:
test-server-cpu1346 pass; drama host 41; Metal drama host 8 (+2 skip). On main,flacgets a 400.Device check pending (an M5 Mac and a GB10): default
wav/pcmsha256 equal to main's; the FLAC decodes to the same samples as thewavreply; a quantizedwav32freply equalswav;drama3-generate --encodecodes equal between main and this branch;zig build nativeon a Mac with the Metal compiler. Conflicts with the speed and voices PRs inspeech.zigandroot.zig(unions).