Inworld AI TTS
The InworldTTSService provides ultra-realistic, context-aware speech synthesis. It is designed for interactive characters and gaming experiences, offering precise voice control and human-like speech quality.
Installation
To use Inworld AI, install the required dependencies:
pip install "piopiy-ai[inworld]"
Prerequisites
- An Inworld AI API key (Get yours here).
- Set your API key in your environment:
export INWORLD_API_KEY="your_api_key_here"
Configuration
InworldTTSService (WebSocket) Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key | str | Required | Your Inworld API key. |
voice_id | str | "Ashley" | ID of the voice to use. |
model | str | "inworld-tts-1" | ID of the model to use. |
params | InputParams | None | Configuration parameters (see below). |
InputParams Options
| Option | Type | Default | Description |
|---|---|---|---|
temperature | float | None | Randomness in speech synthesis. |
speaking_rate | float | None | Speech speed multiplier. |
apply_text_normalization | str | None | Whether to pre-process text. |
Usage
Basic Setup
import os
from piopiy.services.inworld.tts import InworldTTSService
tts = InworldTTSService(
api_key=os.getenv("INWORLD_API_KEY"),
voice_id="Ashley"
)
With Custom Settings
import os
from piopiy.services.inworld.tts import InworldTTSService
tts = InworldTTSService(
api_key=os.getenv("INWORLD_API_KEY"),
voice_id="Ashley",
params=InworldTTSService.InputParams(
temperature=0.8,
speaking_rate=1.1
)
)
Notes
- Real-time Interaction: The WebSocket service (
InworldTTSService) is optimized for low-latency, bidirectional communication, making it ideal for interactive AI agents. - Word Timestamps: This service automatically provides word-level timestamps, enabling precise synchronization of lip-sync and subtitles.