streaming text-to-speech
Streaming text-to-speech that plays as it generates, in the browser or over the phone.
- POST /v1/audio/stream, chunked HTTP
- Up to 20,000 characters per request
- mp3, ogg, aac, pcm, u-law formats
- Sub-300ms first byte with Simba 3.2
definition
Streaming text-to-speech returns audio in chunks as it is generated, over a single HTTP connection. Your app decodes and plays the bytes as they arrive, so the listener hears the first sound almost immediately instead of waiting for the whole clip to render.
how-streaming-works
You call POST /v1/audio/stream. The response is chunked HTTP: audio bytes flow back continuously. Your client reads the stream, decodes each chunk, and feeds it to the audio output. First byte lands in under 300ms with Simba 3.2, and playback continues as generation continues.
audio-formats
Five formats: mp3 for general playback, ogg and aac for compressed delivery, pcm at 24kHz mono for raw audio, and u-law for telephony systems. Pick with the Accept header. WAV is not a streaming format; use the batch speech endpoint when you need a WAV file.
browser-playback
In the browser, read the response stream and feed chunks to the Web Audio API for gapless playback. Buffer a little to smooth network jitter, but not so much that you add latency. The tradeoff is buffer size against responsiveness.
telephony
For phone systems, stream u-law at 8kHz, the format telephony expects. Paired with SIP or a voice agent, streaming TTS puts generated speech straight onto a call with minimal delay.
code-samples
curl -X POST https://api.speechify.ai/v1/audio/stream \
-H "Authorization: Bearer $SPEECHIFY_API_KEY" \
-H "Accept: audio/mpeg" \
-H "Content-Type: application/json" \
-d '{"input": "Playing as it streams.", "voice_id": "george", "model": "simba-3.2"}' \
--output speech.mp3 Frequently asked questions
What is streaming text-to-speech?
Which formats does streaming support?
How much text can I stream per request?
Start building
Streaming text-to-speech that plays as it generates, in the browser or over the phone.