# Coqui TTS

> Open-source text-to-speech with multilingual voice cloning

- Category: Multimodal Generation / Audio, Music & Voice
- Language: Python
- Licence: MPL-2.0
- Repository: https://github.com/coqui-ai/TTS
- Canonical page: https://ai-tldr.dev/tools/coqui-tts/

## In short

Coqui TTS is a Python library for generating speech from text. It ships a collection of pretrained models, including XTTS v2, an end-to-end model that clones a voice from a short audio clip and speaks in 16 languages. It sits in the Audio, Music & Voice category of the Multimodal Generation tools and is open-source, written in Python and licensed MPL-2.0.

## Overview

Coqui TTS is a Python library for generating speech from text. It ships a collection of pretrained models, including XTTS v2, an end-to-end model that clones a voice from a short audio clip and speaks in 16 languages. You can run it from a Python script or the command line.

It is aimed at developers and researchers who want to add speech synthesis to their own projects, or who need to train and fine-tune their own voice models. Alongside inference, it includes tools for model training, dataset analysis, and dataset curation.

Within the speech and audio space, it sits among local, self-hosted TTS options. You download the models and run them on your own machine (CPU or GPU), so audio never has to leave your environment.

## What it does

- Pretrained text-to-speech models covering a large range of languages, downloadable and runnable locally
- XTTS v2 end-to-end model for voice cloning from a short reference clip, with streaming support at under 200ms latency
- Many model families included: Tacotron/Tacotron2, Glow-TTS, VITS, YourTTS, plus Tortoise and Bark for inference
- Python API and a `tts` command-line tool for synthesis
- Training and fine-tuning support through a Trainer API, with terminal and TensorBoard logs
- Utilities for multi-speaker TTS, speaker embeddings, and dataset curation

## Getting started

Install the package from PyPI, then synthesize speech from Python or the command line.

1. Install Coqui TTS

   Install the library with pip. A GPU is optional but speeds up the larger models.

```bash
pip install TTS
```

2. Clone a voice with XTTS v2 in Python

   Load the multilingual XTTS v2 model, pass a short reference clip to clone, and write the result to a WAV file.

```python
import torch
from TTS.api import TTS

device = "cuda" if torch.cuda.is_available() else "cpu"
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(device)
tts.tts_to_file(text="Hello world!", speaker_wav="my/cloning/audio.wav", language="en", file_path="output.wav")
```

3. Synthesize from the command line

   List the available models, then generate speech with the default model and write it to a file.

```bash
tts --list_models
tts --text "Text for TTS" --out_path output/path/speech.wav
```

## When to use it

- Clone a voice from a short clip and have it read text aloud in another language
- Add offline, self-hosted text-to-speech to an app so audio stays on your own machine
- Fine-tune or train a custom voice model on your own dataset
- Generate voiceovers or narration for videos, demos, and accessibility tooling
