Skip to main content

Typecast is an AI text-to-speech API that converts text into lifelike, expressive speech in many languages.

Project description

Pipecat Typecast TTS Integration

Add high-quality neural voices from Typecast to your Pipecat AI pipelines.

Maintainer: Neosapience / Typecast team (@neosapience)

Installation

pip install pipecat-ai-typecast

Prerequisites

  • Typecast API key (TYPECAST_API_KEY)
  • Optional: Voice override (TYPECAST_VOICE_ID) – defaults to tc_62a8975e695ad26f7fb514d1

Usage with Pipecat Pipeline

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 = ...
    sst = ...
    tts = TypecastTTSService(
        aiohttp_session=session,
        api_key=os.getenv("TYPECAST_API_KEY"),
        voice_id=os.getenv("TYPECAST_VOICE_ID", "tc_62a8975e695ad26f7fb514d1"),
    )

    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.

Advanced Configuration (Emotion & Audio Controls)

TypecastTTSService exposes structured parameter models so you can tune emotion and audio output.

from pipecat_typecast.tts import (
    TypecastTTSService,
    TypecastInputParams,
    PromptOptions,
    OutputOptions,
)

params = TypecastInputParams(
    # Language influences pronunciation model (defaults to English)
    # Language.EN / Language.KO / Language.JA ...
    # If omitted, Typecast auto-detect may apply (depending on voice).
    prompt_options=PromptOptions(
        emotion_preset="happy",      # normal | happy | sad | angry | whisper (voice dependent)
        emotion_intensity=1.3,       # 0.0–2.0 (float)
    ),
    output_options=OutputOptions(
        volume=110,                  # 0–200 (percent)
        audio_pitch=2,               # -12..12 (semitones)
        audio_tempo=1.05,            # 0.5–2.0 (playback speed)
        audio_format="wav",          # Only 'wav' currently supported
    ),
)

tts = TypecastTTSService(
    aiohttp_session=session,
    api_key=os.getenv("TYPECAST_API_KEY"),
    voice_id="tc_62a8975e695ad26f7fb514d1",  # Replace with another voice ID as desired
    model="ssfm-v21",                        # Default model
    params=params,
)

Notes:

  • emotion_preset availability varies by voice. If unsupported, the service falls back to neutral.
  • emotion_intensity > 1.0 increases expressiveness; extreme values can sound synthetic.
  • audio_pitch shifts pitch in musical semitone units (use small adjustments for naturalness).
  • audio_tempo changes speaking speed; keep within 0.85–1.15 for intelligibility.
  • seed (set in TypecastInputParams) provides deterministic synthesis for identical text (when supported by model).
  • Unsupported audio_format values yield an error frame—keep wav.

Running the Example

  1. Install dependencies:

    uv sync
    
  2. Set up your environment

    cp env.example .env
    
  3. Run:

    uv run python example.py
    

The bot will create a call (e.g. Daily room) and speak responses using Typecast voices.

Compatibility

Tested with Pipecat v0.0.89

  • Python 3.10+
  • Daily / Twilio / generic WebRTC transports (see example.py)

License

BSD-2-Clause - see LICENSE

Support

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pipecat_ai_typecast-0.0.1.tar.gz (267.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pipecat_ai_typecast-0.0.1-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file pipecat_ai_typecast-0.0.1.tar.gz.

File metadata

  • Download URL: pipecat_ai_typecast-0.0.1.tar.gz
  • Upload date:
  • Size: 267.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for pipecat_ai_typecast-0.0.1.tar.gz
Algorithm Hash digest
SHA256 ab5ccdc94c3c352a3a7cc0d5c3497f98cbf90be24b85b5832f6471cb9e201330
MD5 57153148ffdc3d87ef24a4e09a2dd504
BLAKE2b-256 549d86eb6d698ade95b0f7bee665a16c84333eb8e83bd027f4726e5305f165a4

See more details on using hashes here.

File details

Details for the file pipecat_ai_typecast-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pipecat_ai_typecast-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c9c51a654babb81b81a0d106da6ea365b6fc02835d1de61ea90a56b8a2c71815
MD5 ad01e7f064f40f19840b963a6fcd6879
BLAKE2b-256 161955ff2ce916d46f3be640c11aceab22c5c218e4566c8be16034dde8167361

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page