Skip to main content

Overview

The pipecat-ai framework provides a CambTTSService that integrates Camb.ai’s MARS text-to-speech models into your voice AI pipelines. This integration enables high-quality, low-latency voice synthesis for real-time conversational AI applications.

Key Features

  • MARS Models: Access to Camb.ai’s latest generation TTS models (mars-flash, mars-pro)
  • 140+ Languages: Extensive multilingual support
  • Real-time Streaming: Streaming audio chunks for low-latency output
  • Model-specific Sample Rates: 22.05kHz (mars-flash) or 48kHz (mars-pro)
  • Multiple Transports: Works with Daily, Twilio, WebRTC, and WebSocket transports

Installation

Prerequisites

  • Python 3.9 or higher
  • A Camb.ai API key (get one here)
  • A transport provider account (e.g., Daily, Twilio)

Install Pipecat with Camb.ai Support

For a complete voice agent setup with specific transports:

Quick Start

1. Set Up Environment Variables

Create a room at Daily Dashboard, then create a .env file in your project directory:

2. Create Your Voice Agent

3. Run Your Agent


Configuration

CambTTSService Options

The CambTTSService class accepts the following parameters:

InputParams Options

Available Models

Language Support

Camb.ai supports up to 312 languages depending on the MARS model — see Language Support for the full per-model locale list. Specify the language using Pipecat’s Language enum:

Advanced Usage

Dynamic Settings Updates

Update TTS settings during runtime:

Using with Multiple Transports

Pipecat supports multiple transport backends. Here’s how to configure Camb.ai TTS with different transports:

Metrics and Logging

Track usage and performance with Pipecat’s built-in metrics:
Enable debug logging for detailed information:

Multi-Transport Voice Agent

Here’s a full example using the Pipecat runner utilities for transport-agnostic deployment:

Tutorial: Local Voice Agent

Build a voice agent that runs on your local machine using your microphone and speakers - perfect for quick prototyping.

Installation

Local Audio Example


Tutorial: Self-Hosted WebRTC Agent

Deploy a voice agent accessible from any browser without third-party services.

Installation

WebRTC Server Example

Run and open http://localhost:7860 in your browser.

Troubleshooting

Common Issues

Ensure your CAMB_API_KEY environment variable is set correctly:
Or pass it directly:
The voice ID must be an integer. Browse available voices at Camb.ai Studio to find valid voice IDs.
Camb.ai requires a minimum of 3 characters for TTS synthesis. The service will log a warning and skip synthesis for shorter text.
TTS synthesis can take time for longer texts. The default timeout is 60 seconds. For very long texts, consider:
  • Breaking them into smaller chunks
  • Increasing the timeout: CambTTSService(..., timeout=120.0)
Different models use different sample rates:
  • mars-flash: 22.05kHz
  • mars-pro: 48kHz
The service automatically selects the correct sample rate based on the model. If you need a specific rate, pass it explicitly:

Debug Logging

Enable debug logging for detailed information:

Resources