AniwaffleDocsHomeStudio

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_formatEncodingSample rateChannelsContent-Type
pcm_48000Raw PCM, signed 16-bit little-endian48 kHzMono or stereoaudio/pcm;rate=48000;channels=N
pcm_44100Raw PCM, signed 16-bit little-endian44.1 kHzMono or stereoaudio/pcm;rate=44100;channels=N
pcm_24000Raw PCM, signed 16-bit little-endian24 kHzMono or stereoaudio/pcm;rate=24000;channels=N
aac_44100_128AAC, 128 kbps44.1 kHzMonoaudio/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_48000 gives the highest quality and needs no decoder. Use it for realtime playback, editing and post-production.
  • pcm_24000 suits voice-agent pipelines that run at 24 kHz end to end.
  • pcm_44100 suits pipelines and players fixed at 44.1 kHz.
  • aac_44100_128 gives 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 audio chunks in seq order 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:

WhereFieldExample
HTTP responseX-Audio-Formatpcm_48000
HTTP responseX-Audio-Channels1
HTTP responseX-Audio-Duration-Ms2760
WebSocket audio eventformat"pcm_48000"
WebSocket audio eventchannels2 (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.

Contact our team

Tell us about your character and what you’d like to build.