> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pipecat.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Resemble AI Text-to-Speech

> ResembleAITTSService streams TTS over Resemble AI's WebSocket API with word-level timestamps and audio context management.

## Overview

`ResembleAITTSService` provides high-quality text-to-speech synthesis using Resemble AI's streaming WebSocket API with word-level timestamps and audio context management for handling multiple simultaneous synthesis requests with proper interruption support.

> [card] [Resemble AI TTS API Reference](https://reference-server.pipecat.ai/en/latest/api/pipecat.services.resembleai.tts.html)
>
> Pipecat's API methods for Resemble AI TTS integration

> [card] [Example Implementation](https://github.com/pipecat-ai/pipecat/blob/main/examples/voice/voice-resemble.py)
>
> Complete example with interruption handling

> [card] [Resemble AI Documentation](https://docs.resemble.ai/)
>
> Official Resemble AI API documentation

> [card] [Sign up](https://app.resemble.ai/)
>
> Sign up for a Resemble AI account

## Installation

To use Resemble AI services, install the required dependencies:

```bash theme={null}
uv add "pipecat-ai[resembleai]"
```

## Prerequisites

### Resemble AI Account Setup

Before using Resemble AI TTS services, you need:

1. **Resemble AI Account**: Sign up at [Resemble AI](https://app.resemble.ai)
2. **API Key**: Generate an API key from your [account settings](https://app.resemble.ai/account/api)
3. **Voice Selection**: Choose or create voice UUIDs from your [voice library](https://app.resemble.ai/hub/voices)

### Required Environment Variables

* `RESEMBLE_API_KEY`: Your Resemble AI API key for authentication

## Configuration

### ResembleAITTSService

**api\_key** `str` *required*

Resemble AI API key for authentication.

**voice\_id** `str` *deprecated* (default: None)

*Deprecated since 0.0.105, removed in 2.0.0.* Use
`settings=ResembleAITTSService.Settings(voice=...)` instead.

**settings** `ResembleAITTSService.Settings` (default: None)

Runtime-configurable settings. See [Settings](#settings) below.

**url** `str` (default: wss\://websocket.cluster.resemble.ai/stream)

WebSocket URL for Resemble AI TTS API.

**precision** `str` (default: PCM\_16)

PCM bit depth. Options: `PCM_32`, `PCM_24`, `PCM_16`, or `MULAW`. The service
pushes the audio as 16-bit PCM, so only `PCM_16` plays correctly.

**output\_format** `str` (default: wav)

Audio output format (`wav` or `mp3`). The service pushes the audio as raw PCM,
so only `wav` plays correctly.

**sample\_rate** `int` (default: 22050)

Audio sample rate in Hz. Options: 8000, 16000, 22050, 32000, or 44100.

### Settings

Runtime-configurable settings passed via the `settings` constructor argument using `ResembleAITTSService.Settings(...)`. These can be updated mid-conversation with `TTSUpdateSettingsFrame`. See [Service Settings](https://docs.pipecat.ai/pipecat/fundamentals/service-settings.md) for details.

| Parameter | Type | Default | Description |
| - | - | - | - |
| `model` | `str` | `None` | Not sent by this service; reported only as the model name in metrics and traces. *(Inherited.)* |
| `voice` | `str` | `None` | Voice UUID. There is no default voice, so set one. *(Inherited.)* |
| `language` | `Language \| str` | `None` | Language used to split text into sentences; not sent to Resemble AI. *(Inherited.)* |

## Usage

### Basic Setup

```python theme={null}
import os

from pipecat.services.resembleai.tts import ResembleAITTSService

tts = ResembleAITTSService(
    api_key=os.getenv("RESEMBLE_API_KEY"),
    settings=ResembleAITTSService.Settings(
        voice="your-voice-uuid",
    ),
)
```

### With Custom Settings

```python theme={null}
from pipecat.services.resembleai.tts import ResembleAITTSService

tts = ResembleAITTSService(
    api_key=os.getenv("RESEMBLE_API_KEY"),
    settings=ResembleAITTSService.Settings(
        voice="your-voice-uuid",
    ),
    sample_rate=16000,
    precision="PCM_16",
    output_format="wav",
)
```

## Notes

* **Word-level timestamps**: Resemble AI provides word-level timing information, enabling synchronized text highlighting and precise interruption handling.
* **Jitter buffering**: The service holds back the first 44,100 bytes of each response's audio before pushing any, which delays the start of speech by about 1 second at the default 22050 Hz (about half a second at 44100 Hz).
* **Audio context management**: Supports multiple simultaneous synthesis requests with proper context tracking and interruption handling.
* **Default sample rate**: Defaults to 22050 Hz. Supported rates are 8000, 16000, 22050, 32000, and 44100 Hz.

## Event Handlers

Resemble AI TTS supports the standard [service connection events](https://docs.pipecat.ai/api-reference/server/events/service-events.md):

| Event | Description |
| - | - |
| `on_connected` | Connected to Resemble AI WebSocket |
| `on_disconnected` | Disconnected from Resemble AI WebSocket |
| `on_connection_error` | WebSocket connection error occurred |

```python theme={null}
@tts.event_handler("on_connected")
async def on_connected(service):
    print("Connected to Resemble AI")
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.