Please use our dedicated channels for questions and discussion. Help is much more valuable if it's shared publicly so that more people can benefit from it.
[!NOTE]
From coqui-tts 0.27.4, PyTorch is not included by default and you need to install it yourself.
🐸TTS is tested on Ubuntu 24.04 with python >= 3.10, < 3.15 and PyTorch
2.2+, but should also work on Mac and Windows.
It is strongly recommended to use uv to install
everything into a virtual environment (otherwise leave out uv from the
commands below).
First install PyTorch, torchaudio, and (only for PyTorch 2.9+) torchcodec
with their official instructions,
choosing the CPU/CUDA/ROCm version as necessary. Or let uv automatically select
the right version for your system:
There are also the following convenience extras to automatically install the
PyTorch dependencies. Note that the CPU/CUDA selection only works with uv and
when installing Coqui from source. With other package managers or when installing
coqui-tts from PyPI, the PyTorch dependencies will be installed from PyPI.
Name
Description
cpu
Install torch, torchaudio (CPU)
cuda
Install torch, torchaudio (CUDA)
codec
Install torchcodec (CPU), needed with PyTorch>=2.9
codec-cuda
Install torchcodec (CUDA), needed with PyTorch>=2.9
Platforms
If you are on Ubuntu (Debian), you can also run the following commands for installation.
make system-deps
make install
Docker Image
You can also try out Coqui TTS without installation with the docker image.
Simply run the following command and you will be able to run TTS:
docker run --rm -it -p 5002:5002 --entrypoint /bin/bash ghcr.io/idiap/coqui-tts-cpu
python3 TTS/server/server.py --list_models #To get the list of available models
python3 TTS/server/server.py --model_name tts_models/en/vctk/vits # To start a server
You can then enjoy the TTS server here. More details,
like GPU support and a Docker Compose configuration, can be found in the
documentation.
Synthesizing speech by 🐸TTS
🐍 Python API
Multi-speaker and multi-lingual model
import torch
from TTS.api import TTS
# Get device
device = "cuda" if torch.cuda.is_available() else "cpu"
# List available 🐸TTS models
print(TTS().list_models())
# Initialize TTS
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(device)
# List speakers
print(tts.speakers)
# Run TTS
# ❗ XTTS supports both, but many models allow only one of the `speaker` and
# `speaker_wav` arguments
# TTS with list of amplitude values as output, clone the voice from `speaker_wav`
wav = tts.tts(
text="Hello world!",
speaker_wav="my/cloning/audio.wav",
language="en"
)
# TTS to a file, use a preset speaker
tts.tts_to_file(
text="Hello world!",
speaker="Craig Gutsy",
language="en",
file_path="output.wav"
)
From version 0.27.0 you can cache cloned
voices with a custom
speaker ID, so you only need to pass audio files in speaker_wav once.
[!NOTE]
For more control or additional outputs, e.g. timestamps, use the lower-level
Synthesizer API.
Single speaker model
# Initialize TTS with the target model name
tts = TTS("tts_models/de/thorsten/tacotron2-DDC").to(device)
# Run TTS
tts.tts_to_file(text="Ich bin eine Testnachricht.", file_path=OUTPUT_PATH)
Voice conversion (VC)
Converting the voice in source_wav to the voice of target_wav:
Voice cloning by combining single speaker TTS model with the default VC model
This way, you can clone voices by using any model in 🐸TTS. The FreeVC model is
used for voice conversion after synthesizing speech.
tts = TTS("tts_models/de/thorsten/tacotron2-DDC")
tts.tts_with_vc_to_file(
"Wie sage ich auf Italienisch, dass ich dich liebe?",
speaker_wav="target/speaker.wav",
file_path="output.wav"
)
TTS using Fairseq models in ~1100 languages 🤯
For Fairseq models, use the following name format: tts_models/<lang-iso_code>/fairseq/vits.
You can find the language ISO codes here
and learn about the Fairseq models here.
# TTS with fairseq models
api = TTS("tts_models/deu/fairseq/vits")
api.tts_to_file(
"Wie sage ich auf Italienisch, dass ich dich liebe?",
file_path="output.wav"
)
Note: Some Fairseq models need the romanization library uroman to be
installed. For this you can install coqui-tts with the languages extra.
Command-line interface tts
Synthesize speech on the command line.
You can either use your trained model or choose a model from the provided list.
List provided models:
tts --list_models
Get model information. Use the names obtained from --list_models.