Overview
GradiumTTSService provides high-quality text-to-speech synthesis using Gradium’s WebSocket API with expressive voices, instant voice cloning, streaming inference for real-time applications, and multilingual support.
Gradium TTS API Reference
Pipecat’s API methods for Gradium TTS integration
Example Implementation
Complete example with streaming synthesis
Gradium Documentation
Official Gradium TTS API documentation
Gradium Platform
Access API keys and voice library
Installation
To use Gradium services, install the required dependencies:Prerequisites
Gradium Account Setup
Before using Gradium TTS services, you need:- Gradium Account: Sign up at Gradium
- API Key: Generate an API key from your account dashboard
- Voice Selection: Choose voice IDs from the Gradium platform or create custom voices
Required Environment Variables
GRADIUM_API_KEY: Your Gradium API key for authentication
Configuration
GradiumTTSService
Gradium API key for authentication.
Voice identifier.
Gradium WebSocket API endpoint.
Model ID to use for synthesis.
Optional JSON configuration string for additional model settings.
Runtime-configurable generation settings. See InputParams below.
InputParams
Generation settings that can be set at initialization via theparams constructor argument.
| Parameter | Type | Default | Description |
|---|---|---|---|
temp | float | 0.6 | Temperature for generation. |
The Gradium service outputs audio at a fixed 48kHz sample rate. This is set automatically and cannot be changed.
Usage
Basic Setup
With Custom Configuration
Notes
- Word timestamps: Gradium provides word-level timestamps for synchronized text display.
- Voice switching: Changing the voice at runtime via
UpdateSettingsFrameautomatically disconnects and reconnects the WebSocket with the new voice configuration. - Fixed sample rate: Gradium always outputs at 48kHz. The sample rate is not configurable.
Event Handlers
Gradium TTS supports the standard service connection events:| Event | Description |
|---|---|
on_connected | Connected to Gradium WebSocket |
on_disconnected | Disconnected from Gradium WebSocket |
on_connection_error | WebSocket connection error occurred |