Skip to main content

Inworld AI 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

ParameterTypeDefaultDescription
api_keystrRequiredYour Inworld API key.
voice_idstr"Ashley"ID of the voice to use.
modelstr"inworld-tts-1"ID of the model to use.
paramsInputParamsNoneConfiguration parameters (see below).

InputParams Options

OptionTypeDefaultDescription
temperaturefloatNoneRandomness in speech synthesis.
speaking_ratefloatNoneSpeech speed multiplier.
apply_text_normalizationstrNoneWhether 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.