Early Beta — The Web SDK is in early beta. APIs may change between releases.
Overview
The Text-to-Speech (TTS) API converts text to spoken audio using on-device neural voice synthesis with Piper TTS compiled to WebAssembly. All synthesis happens locally in the browser.Basic Usage
Setup
Before synthesizing, load a TTS voice model:API Reference
TTS.loadVoice
Load a TTS voice model.
TTSVoiceConfig
TTS.synthesize
Convert text to audio data.
TTSSynthesizeOptions
TTSSynthesisResult
Examples
Basic Synthesis with Playback
With Speed Options
Multi-Speaker Model
React TTS Component
TextToSpeech.tsx
Voice Properties
After loading a voice, check its properties:Speed Options
Error Handling
Related
TTS Voices
Available voices and voice management
Voice Agent
Full voice pipeline
Audio Playback
Playing synthesized audio