Text to Speech
Output formats
Choose the audio encoding and sample rate per request with output_format. Waffle models produce 16-bit PCM at 24, 44.1 or 48 kHz, and AAC.
Supported formats
output_format | Encoding | Sample rate | Channels | Content-Type |
|---|---|---|---|---|
pcm_48000 | Raw PCM, signed 16-bit little-endian | 48 kHz | Mono or stereo | audio/pcm;rate=48000;channels=N |
pcm_44100 | Raw PCM, signed 16-bit little-endian | 44.1 kHz | Mono or stereo | audio/pcm;rate=44100;channels=N |
pcm_24000 | Raw PCM, signed 16-bit little-endian | 24 kHz | Mono or stereo | audio/pcm;rate=24000;channels=N |
aac_44100_128 | AAC, 128 kbps | 44.1 kHz | Mono | audio/aac |
The channel count comes from the model: Waffle Mono returns one channel, Waffle Stereo returns two. Waffle Stereo supports the PCM formats only.
Choose a format
pcm_48000gives the highest quality and needs no decoder. Use it for realtime playback, editing and post-production.pcm_24000suits voice-agent pipelines that run at 24 kHz end to end.pcm_44100suits pipelines and players fixed at 44.1 kHz.aac_44100_128gives compact files that play directly in browsers and media players. Use it for downloads and storage.
Work with PCM
PCM output is raw sample data with no file header. The number in the format name is the sample rate; every format uses 16-bit samples.
- Byte layout. Each sample is a signed 16-bit little-endian integer. Stereo interleaves frames as
L0 R0 L1 R1 …. - Duration. Seconds =
bytes / (sample_rate × channels × 2). - Streaming. Concatenate
audiochunks inseqorder before decoding. A chunk boundary is not guaranteed to fall on a sample frame. - Playing a file. Add a WAV header first:
Python
import wave
with open("speech.pcm", "rb") as file:
pcm = file.read()
with wave.open("speech.wav", "wb") as wav:
wav.setnchannels(1) # 2 for Waffle Stereo
wav.setsampwidth(2) # 16-bit samples
wav.setframerate(48000) # match output_format
wav.writeframes(pcm)Read the delivered format
Use the format the server reports, not the one you assume:
| Where | Field | Example |
|---|---|---|
| HTTP response | X-Audio-Format | pcm_48000 |
| HTTP response | X-Audio-Channels | 1 |
| HTTP response | X-Audio-Duration-Ms | 2760 |
WebSocket audio event | format | "pcm_48000" |
WebSocket audio event | channels | 2 (present for stereo; absent means mono) |
A format the model can't produce is rejected with 400 unsupported_output_format. The voice and model lists in GET /v1/voices and GET /v1/models show which formats each one supports.