> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://murf.ai/api/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://murf.ai/api/docs/_mcp/server.

# Pipecat and Murf

This is an official integration of Murf for [Pipecat](https://github.com/pipecat-ai/pipecat), a framework for building voice and multimodal conversational AI applications. You can install the Python package `pipecat-murf-tts` to use Murf as a TTS service in your Pipecat pipelines, providing high-quality voice synthesis with real-time streaming capabilities.

## Introduction to Pipecat

Pipecat is an open-source framework developed by [Daily](https://www.daily.co/) that simplifies the creation of voice and multimodal conversational AI applications. It provides a flexible pipeline architecture that allows you to connect various components like speech-to-text (STT), large language models (LLMs), and text-to-speech (TTS) services seamlessly.

With the official Murf TTS integration for Pipecat, you can build sophisticated voice applications that combine Murf's natural-sounding voices with other AI services, creating end-to-end conversational experiences.

#### [pipecat-murf-tts](https://github.com/murf-ai/pipecat-murf-tts)

The official Murf TTS integration for Pipecat

## Features

The Murf TTS integration for Pipecat provides a comprehensive set of features for building voice applications:

* **High-Quality Voice Synthesis**: Leverage Murf's advanced TTS technology with access to over 150 voices across 35+ languages
* **Real-time Streaming**: WebSocket-based streaming for low-latency audio generation, perfect for interactive conversations
* **Voice Customization**: Control voice style, rate, pitch, and variation to match your application's needs
* **Multi-Language Support**: Multiple languages and locales with native speaker quality
* **Flexible Configuration**: Comprehensive audio format and quality options including sample rate, channel type, and output formats
* **Metrics Support**: Built-in performance tracking and monitoring capabilities

## Requirements

The Murf TTS integration for Pipecat has the following requirements:

* Python >= 3.10, \< 3.13
* pipecat-ai >= 0.0.97, \< 0.1.0
* websockets >= 15.0.1, \< 16.0
* loguru >= 0.7.3
* python-dotenv >= 1.1.1

Make sure you have these dependencies installed before using the integration.

## Compatibility

This integration has been tested with **Pipecat v0.0.87**. For compatibility with other versions, please refer to the [Pipecat changelog](https://github.com/pipecat-ai/pipecat/blob/main/CHANGELOG.md).

## Installation

You can install the Murf TTS integration for Pipecat using several methods:

### Using pip

The recommended way to install the package is using pip:

```bash
pip install pipecat-murf-tts
```

### Using uv

If you're using `uv` as your Python package manager:

```bash
uv add pipecat-murf-tts
```

### From source

To install from source, clone the repository and install it in development mode:

```bash
git clone https://github.com/murf-ai/pipecat-murf-tts.git
cd pipecat-murf-tts
pip install -e .
```

## Quick Start

### Get Your Murf API Key

Before you can use the integration, you'll need a Murf API key. Sign up at the [Murf API Dashboard](https://murf.ai/api/dashboard) and generate your API key from the dashboard.

### Environment Setup

To keep your API keys secure, it's recommended to use environment variables. Create a `.env` file in your project root:

```env
MURF_API_KEY=your_murf_api_key_here
DEEPGRAM_API_KEY=your_deepgram_api_key_here  # Required for STT
OPENAI_API_KEY=your_openai_api_key_here       # Required for LLM
```

Then load these variables in your Python code using `python-dotenv`:

```python
from dotenv import load_dotenv
load_dotenv()
```

### Basic Usage

Here's a simple example of how to initialize and use the Murf TTS service in your Pipecat pipeline:

```python
import asyncio
import os
from dotenv import load_dotenv
from pipecat.pipeline.pipeline import Pipeline
from pipecat.pipeline.runner import PipelineRunner
from pipecat.pipeline.task import PipelineTask
from pipecat_murf_tts import MurfTTSService

load_dotenv()

async def main():
    # Initialize the Murf TTS service
    tts = MurfTTSService(
        api_key=os.getenv("MURF_API_KEY"),
        params=MurfTTSService.InputParams(
            voice_id="Ruby",
            style="Conversational",
            rate=0,
            pitch=0,
            sample_rate=44100,
            format="PCM",
        ),
    )

    # Create a simple pipeline with just TTS
    pipeline = Pipeline([tts])

    # Create and run the pipeline task
    task = PipelineTask(pipeline)
    runner = PipelineRunner()
    await runner.run(task)

if __name__ == "__main__":
    asyncio.run(main())
```

### Complete Example with Pipeline

Here's a complete example that demonstrates how to build a full conversational AI pipeline with Speech-to-Text (STT), LLM, and Text-to-Speech (TTS) using Deepgram for STT, OpenAI for LLM, and Murf for TTS:

```python
import asyncio
import os
from dotenv import load_dotenv
from pipecat.pipeline.pipeline import Pipeline
from pipecat.pipeline.runner import PipelineRunner
from pipecat.pipeline.task import PipelineTask
from pipecat.services.deepgram import DeepgramSTTService
from pipecat.services.openai.llm import OpenAILLMService
from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext
from pipecat_murf_tts import MurfTTSService

load_dotenv()

async def main():
    # Initialize the Deepgram STT service
    stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY"))

    # Initialize the Murf TTS service
    tts = MurfTTSService(
        api_key=os.getenv("MURF_API_KEY"),
        params=MurfTTSService.InputParams(
            voice_id="Ruby",
            style="Conversational",
        ),
    )

    # Initialize the LLM service
    llm = OpenAILLMService(api_key=os.getenv("OPENAI_API_KEY"))

    # Set up the conversation context
    messages = [
        {"role": "system", "content": "You are a helpful assistant."},
    ]
    context = OpenAILLMContext(messages)
    context_aggregator = llm.create_context_aggregator(context)

    # Create the pipeline connecting STT, LLM, and TTS
    pipeline = Pipeline([
        stt,
        llm,
        tts,
        context_aggregator.assistant(),
    ])

    # Run the pipeline
    task = PipelineTask(pipeline)
    runner = PipelineRunner()
    await runner.run(task)

if __name__ == "__main__":
    asyncio.run(main())
```

> 💡 **Try it out**: For a complete working example with browser-based interaction, check out the [Pipecat Quickstart repository](https://github.com/pipecat-ai/pipecat-quickstart). You can clone the repo and replace the TTS service with Murf to see a full STT → LLM → TTS pipeline in action.

## Configuration

The `MurfTTSService.InputParams` class provides extensive configuration options to customize the voice output according to your needs.

### InputParams Reference

| Parameter      | Type  | Default            | Range/Options                                                    | Description                                                                |
| -------------- | ----- | ------------------ | ---------------------------------------------------------------- | -------------------------------------------------------------------------- |
| `voice_id`     | `str` | `"Ruby"`           | Any valid Murf voice ID                                          | Voice identifier for TTS synthesis                                         |
| `style`        | `str` | `"Conversational"` | Voice-specific styles                                            | Voice style (e.g., "Conversational", "Narration")                          |
| `rate`         | `int` | `0`                | `-50` to `50`                                                    | Speech rate adjustment                                                     |
| `pitch`        | `int` | `0`                | `-50` to `50`                                                    | Pitch adjustment                                                           |
| `variation`    | `int` | `1`                | `0` to `5`                                                       | Variation in pause, pitch, and speed (Unavailable for FALCON 2, Gen2 only) |
| `model`        | `str` | `"falcon-2"`       | `"falcon-2"`, `"gen2"`                                           | The model to use for audio output                                          |
| `sample_rate`  | `int` | `44100`            | `8000`, `24000`, `44100`, `48000`                                | Audio sample rate in Hz                                                    |
| `channel_type` | `str` | `"MONO"`           | `"MONO"`, `"STEREO"`                                             | Audio channel configuration                                                |
| `format`       | `str` | `"PCM"`            | `"MP3"`, `"WAV"`, `"FLAC"`, `"ALAW"`, `"ULAW"`, `"PCM"`, `"OGG"` | Audio output format                                                        |
| `locale`       | `str` | `None`             | Language codes (e.g., `"en-US"`)                                 | Language for Gen2 model audio                                              |

### Example with Custom Configuration

You can customize various aspects of the voice output to match your application's requirements:

```python
from pipecat_murf_tts import MurfTTSService

tts = MurfTTSService(
    api_key="your-api-key",
    params=MurfTTSService.InputParams(
        voice_id="Natalie",
        style="Narration",
        rate=10,
        pitch=-5,
        variation=3,  # Only available when model="GEN2"
        model="GEN2",
        sample_rate=48000,
        channel_type="STEREO",
        format="WAV",
        locale="en-US"
    ),
)
```

## Available Voices

#### [Find your Perfect Voice](https://murf.ai/api/products/text-to-speech/Falcon?utm_source=murf_api_docs)

Explore, preview, and select from 150+ voices in 20+ expressive styles

## Advanced Features

### Dynamic Voice Changes

You can change the voice dynamically during runtime without recreating the service instance:

```python
tts.set_voice("en-US-natalie")
```

This is particularly useful for applications that need to switch between different voices or languages during a conversation.

## Examples

The [pipecat-murf-tts repository](https://github.com/murf-ai/pipecat-murf-tts) includes complete working examples that demonstrate various use cases:

* **Basic TTS Pipeline**: A foundational example showing how to set up a pipeline with LLM and TTS

To run the examples:

```bash
uv add pipecat-ai
python examples/foundational/murf_tts_basic.py
```

For a complete end-to-end example with STT, LLM, and TTS, check out the [Pipecat Quickstart repository](https://github.com/pipecat-ai/pipecat-quickstart). You can use it as a starting point and replace the TTS service with Murf to build a full conversational AI application.

## Support

If you encounter any issues or have questions about the integration:

* **Email**: [support@murf.ai](mailto:support@murf.ai)
* **Website**: [murf.ai](https://murf.ai/)
* **Documentation**: [Murf API Documentation](https://murf.ai/api/docs)
* **Issues**: [GitHub Issues](https://github.com/murf-ai/pipecat-murf-tts/issues)

## Contributing

Contributions to the integration are welcome! If you'd like to contribute, please feel free to submit a Pull Request on the [GitHub repository](https://github.com/murf-ai/pipecat-murf-tts).

## License

This project is licensed under the MIT License. See the [LICENSE](https://github.com/murf-ai/pipecat-murf-tts/blob/main/LICENSE) file for details.