Skip to content

Audio formats

Choose the format with response_format. The default is mp3, which every player and browser plays.

response_format Content-Type Audio Characters per request
mp3 (default) audio/mpeg Compressed 4,096
wav audio/wav 16-bit, mono, 24 kHz, with a WAV header 4,096
pcm audio/pcm Raw 16-bit signed little-endian, mono, 24 kHz, no header (as in OpenAI) 4,096
aac audio/mp4 AAC in an MP4 (M4A) file About 900 (one chunk)
opus audio/opus Compressed About 900 (one chunk)
flac audio/flac Lossless About 900 (one chunk)

Any other value is refused with 400 unsupported_format. The format does not change the price.

  • mp3 for files to store, download or play in a browser. It is small, plays everywhere, and takes the longest text.
  • pcm to play audio as it arrives in your own code, or to feed it into another audio pipeline: there is no header or container to parse, so every byte is audio.
  • wav when a tool needs an uncompressed file it can open.
  • aac, opus and flac when your platform needs exactly that format, for short text only.

Text longer than 900 billable characters is spoken in chunks and joined into one file (Streaming and long text). mp3, wav and pcm can be joined; aac, opus and flac cannot, so in those formats the whole text must fit in one chunk, and longer text is refused with 400 input_too_long_for_format. For long text, ask for mp3, wav or pcm, and convert afterwards if you need another format.

Terminal window
curl https://api.aderra.ai/v1/audio/speech \
-H "Authorization: Bearer $ADERRA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "aderra-voice-1", "voice": "Daniel",
"input": "Hello from Aderra.", "response_format": "wav"}' \
--output hello.wav

A wav is streamed, so its header can’t know the final length: its RIFF and data sizes are set to the maximum, meaning “until the end of the file”, the usual convention for streaming WAV. Most players and libraries accept it. If a tool needs exact sizes, rewrite the header once the file is complete, or ask for pcm and add your own header, as below.

Terminal window
curl https://api.aderra.ai/v1/audio/speech \
-H "Authorization: Bearer $ADERRA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "aderra-voice-1", "voice": "Daniel",
"input": "Hello from Aderra.", "response_format": "pcm"}' \
--output hello.pcm

A pcm file has no header, so tell the player what it holds: 16-bit signed little-endian (s16le) at 24,000 Hz. Mono is the default for raw audio, so no channel option is needed:

Terminal window
ffplay -f s16le -ar 24000 -autoexit hello.pcm

To convert it to a file any player opens:

Terminal window
ffmpeg -f s16le -ar 24000 -ac 1 -i hello.pcm hello.wav

GET /v1/audio/models gives each format’s content_type and max_characters, and sample_rate, channels and bits_per_sample for pcm and wav, under data[0].response_formats.