Skip to main content

Overview

TTS streaming allows you to play audio as it’s being synthesized, providing faster time-to-first-audio for long text. This is especially useful for reading long articles or generating AI responses.

Basic Usage

API Reference

synthesizeStream

Synthesize text with streaming audio chunks.
Parameters:

TTSOutput (Chunk)

Examples

Streaming Playback

StreamingTTS.tsx

Audio Queue Manager

For smooth playback, manage an audio queue using the SDK’s Audio utility:
AudioContext / Web Audio API does not work in React Native. Always use RunAnywhere.Audio.createWavFromPCMFloat32() to convert TTS output before playback.

Custom Hook

useTTSStream.ts

With Progress Tracking

Performance Considerations

Streaming provides faster time-to-first-audio (TTFA) for long text. For short phrases (< 100 characters), the overhead may not be worth it — use synthesize() instead.

When to Use Streaming

Buffer Size

Chunks are typically 0.5-2 seconds of audio. This provides a good balance between:
  • Latency: Smaller chunks = faster first audio
  • Efficiency: Larger chunks = less overhead

Error Handling

Synthesize

Basic synthesis

TTS Voices

Available voices

Voice Agent

Full voice pipeline