Overview
FishAudioTTSService provides real-time text-to-speech synthesis through Fish Audio’s WebSocket-based streaming API. The service offers custom voice models, prosody controls, and multiple audio formats optimized for conversational AI applications with low latency.
Fish TTS API Reference
Pipecat’s API methods for Fish Audio TTS integration
Example Implementation
Complete example with custom voice model
Fish Audio Documentation
Official Fish Audio documentation
Voice Models
Create and manage custom voice models
Installation
To use Fish Audio services, install the required dependencies:Prerequisites
Fish Audio Account Setup
Before using Fish Audio TTS services, you need:- Fish Audio Account: Sign up at Fish Audio Console
- API Key: Generate an API key from your account dashboard
- Voice Models: Create or select custom voice models for synthesis
Required Environment Variables
FISH_API_KEY: Your Fish Audio API key for authentication
Configuration
FishAudioTTSService
Fish Audio API key for authentication.
Reference ID of the voice model to use for synthesis.
Fish Audio TTS model to use.
Audio output format. Options:
"pcm", "opus", "mp3", "wav".Output audio sample rate in Hz. When
None, uses the pipeline’s configured sample rate.Runtime-configurable voice settings. See InputParams below.
InputParams
Voice and generation settings that can be set at initialization via theparams constructor argument.
| Parameter | Type | Default | Description |
|---|---|---|---|
language | Language | Language.EN | Language for synthesis. |
latency | str | "normal" | Latency mode: "normal" or "balanced". |
normalize | bool | True | Whether to normalize audio output. |
prosody_speed | float | 1.0 | Speech speed multiplier (0.5-2.0). |
prosody_volume | int | 0 | Volume adjustment in dB. |
Usage
Basic Setup
With Prosody Controls
Notes
reference_idrequired: You must specify eitherreference_id(preferred) or the deprecatedmodelparameter. Passing both raises aValueError.- Model switching: Changing the model via
set_model()automatically disconnects and reconnects the WebSocket with the new model configuration.
Event Handlers
Fish Audio TTS supports the standard service connection events:| Event | Description |
|---|---|
on_connected | Connected to Fish Audio WebSocket |
on_disconnected | Disconnected from Fish Audio WebSocket |
on_connection_error | WebSocket connection error occurred |