Gradium
The GradiumTTSService provides high-fidelity, low-latency text-to-speech using Gradium's specialized neural voice technology. It features a persistent WebSocket connection for sub-second synthesis and sub-word timestamp support.
Installation
To use Gradium, install the required dependencies:
pip install "piopiy-ai[gradium]"
Prerequisites
- A Gradium account and API key (Get yours here).
- Set your API key in your environment:
export GRADIUM_API_KEY="your_api_key_here"
Configuration
GradiumTTSService Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key | str | Required | Your Gradium API key. |
voice_id | str | "YTpq7expH9539ERJ" | The voice identifier to use. |
url | str | wss://eu.api.gradium.ai/api/speech/tts | Gradium WebSocket endpoint. |
model | str | "default" | Model ID to use for synthesis. |
json_config | str | None | Optional JSON for additional model settings. |
params | InputParams | InputParams() | Advanced generation settings. |
InputParams
| Parameter | Type | Default | Description |
|---|---|---|---|
temp | float | 0.6 | Temperature for generation randomness. |
Usage
Basic Setup
import os
from piopiy.services.gradium.tts import GradiumTTSService
tts = GradiumTTSService(
api_key=os.getenv("GRADIUM_API_KEY"),
voice_id="YTpq7expH9539ERJ"
)
Notes
- WebSocket Connection: Gradium uses a persistent WebSocket connection to minimize handshaking latency during live calls.
- High Fidelity: Default output is mono PCM at 48kHz, providing rich and articulate voice quality.
- Word Timestamps: Supports real-time word-level timing information, enabling synchronized visual cues and lip-syncing.