Typecast TTS Integration for Pipecat AI Pipelines
Add high-quality neural voices from Typecast to your Pipecat AI pipelines.
pip install pipecat-ai-typecast| Variable | Required | Description |
|---|---|---|
TYPECAST_API_KEY |
Yes | Get your API key here |
TYPECAST_VOICE_ID |
No | Voice override (defaults to tc_672c5f5ce59fac2a48faeaee) |
TypecastTTSService integrates Typecast's streaming text-to-speech into a Pipecat pipeline. It converts LLM text output into expressive speech while leveraging Pipecat's transport, STT, and turn-taking stack.
import os, aiohttp
from pipecat.pipeline.pipeline import Pipeline
from pipecat_typecast.tts import TypecastTTSService
async with aiohttp.ClientSession() as session:
llm = ...
stt = ...
tts = TypecastTTSService(
aiohttp_session=session,
api_key=os.getenv("TYPECAST_API_KEY"),
voice_id=os.getenv("TYPECAST_VOICE_ID", "tc_672c5f5ce59fac2a48faeaee"),
)
pipeline = Pipeline([
transport.input(), # audio/user input
stt, # speech to text
context_aggregator.user(), # add user text to context
llm, # LLM generates response
tts, # Typecast TTS synthesis
transport.output(), # stream audio back to user
context_aggregator.assistant(), # store assistant response
])See example.py for a complete working example including event handlers and transport setup.
TypecastTTSService exposes structured parameter models for emotion and audio control.
from pipecat_typecast.tts import (
TypecastTTSService,
TypecastInputParams,
PresetPromptOptions,
OutputOptions,
)
params = TypecastInputParams(
prompt_options=PresetPromptOptions(
emotion_preset="happy", # normal | happy | sad | angry | whisper | toneup | tonedown
emotion_intensity=1.3, # 0.0 - 2.0
),
output_options=OutputOptions(
volume=110, # 0 - 200 (percent)
audio_pitch=2, # -12 to 12 (semitones)
audio_tempo=1.05, # 0.5 - 2.0 (playback speed)
audio_format="wav", # Only 'wav' supported
),
)
tts = TypecastTTSService(
aiohttp_session=session,
api_key=os.getenv("TYPECAST_API_KEY"),
voice_id="tc_672c5f5ce59fac2a48faeaee",
model="ssfm-v30",
params=params,
)For context-aware emotional delivery, use SmartPromptOptions which infers emotion from surrounding text:
from pipecat_typecast.tts import (
TypecastTTSService,
TypecastInputParams,
SmartPromptOptions,
)
params = TypecastInputParams(
prompt_options=SmartPromptOptions(
previous_text="I just got the best news ever!", # max 2000 chars
next_text="I can't wait to share this with everyone!",
),
)
tts = TypecastTTSService(
aiohttp_session=session,
api_key=os.getenv("TYPECAST_API_KEY"),
params=params,
)For backward compatibility with ssfm-v21
from pipecat_typecast.tts import (
TypecastTTSService,
TypecastInputParams,
PromptOptions,
)
params = TypecastInputParams(
prompt_options=PromptOptions(
emotion_preset="happy", # normal | happy | sad | angry
emotion_intensity=1.3,
),
)
tts = TypecastTTSService(
aiohttp_session=session,
api_key=os.getenv("TYPECAST_API_KEY"),
model="ssfm-v21",
params=params,
)| Parameter | Range | Description |
|---|---|---|
emotion_preset |
varies by voice | ssfm-v30 adds: whisper, toneup, tonedown |
emotion_intensity |
0.0 - 2.0 | Values > 1.0 increase expressiveness |
audio_pitch |
-12 to 12 | Semitone adjustment |
audio_tempo |
0.5 - 2.0 | Recommended: 0.85 - 1.15 |
seed |
integer | Deterministic synthesis for identical text |
# 1. Install dependencies
uv sync
# 2. Configure environment
cp env.example .env
# 3. Run
uv run python example.pyThe bot will create a call (e.g. Daily room) and speak responses using Typecast voices.
| Requirement | Version |
|---|---|
| Pipecat | v0.0.94+ |
| Python | 3.10+ |
| Transports | Daily / Twilio / WebRTC |
- API Documentation: typecast.ai
- Pipecat Discord: discord.gg/pipecat (
#community-integrations)
Maintainer: Neosapience / Typecast team (@neosapience)
BSD-2-Clause License