Get all available audio output formats
The formats endpoint returns a list of all supported audio output formats.
GET /v1/talk/formatsRequires a do_live_* API key with the talk:formats scope.
curl -H "Authorization: Bearer do_live_your_key_here" \
"https://api.do.dev/v1/talk/formats"{
"formats": [
{
"id": "mp3",
"contentType": "audio/mpeg"
},
{
"id": "wav",
"contentType": "audio/wav"
},
{
"id": "flac",
"contentType": "audio/flac"
},
{
"id": "aac",
"contentType": "audio/aac"
},
{
"id": "opus",
"contentType": "audio/opus"
}
]
}| Format | Content-Type | Compression | Quality | Best For |
|---|---|---|---|---|
mp3 | audio/mpeg | Lossy | Good | Web delivery, broad compatibility |
wav | audio/wav | None | Highest | Audio editing, archival |
flac | audio/flac | Lossless | Highest | Archival, audiophile applications |
aac | audio/aac | Lossy | Very Good | Apple devices, iOS apps |
opus | audio/opus | Lossy | Excellent | WebRTC, real-time streaming |
You can specify a sample rate with the sampleRate parameter in the speech endpoint:
| Sample Rate | Description |
|---|---|
| 8000 Hz | Telephone quality |
| 16000 Hz | Wideband voice |
| 24000 Hz | Default, good balance |
| 48000 Hz | CD quality |
Higher sample rates produce better quality audio but larger file sizes.
async function generateHighQualityAudio(text) {
const response = await fetch("https://api.do.dev/v1/talk/speech", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.DO_API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
text,
voice: "aria",
format: "wav",
sampleRate: 48000
})
});
return response.blob();
}