(1) INSTALLATION
A local TTS, installed on your own server! I am using Windows. Some things may be different for Mac/Linux, but here is what you need:
- As on Coqui TTS Github, Python 3.8 to 3.10 should work.
- If you have an incompatible version, do the usual "use different Python version with virtualenv".
- Install Microsoft C++ build tools.
- Pick “Visual Studio Community, Desktop Environment For C++”.
- Not sure if .NET is required. Just install if you want to be safe.
-
espeak. Linux users,
apt-get install espeak
.
(2) PROJECT SETUP
- Create project folder. E.G.
D:\COQUI
. - Create virtual environment.
virtualenv venv
- For Windows
venv\Scripts\activate
- For Linux/Mac
venv/bin/activate
- Download Coqui –
pip install tts
(3) 3 WAYS TO RUN COQUI TTS
(3A) COMMAND LINE
tts --text "YOUR TEXT" --out_path PATH/SPEECH.WAV
- Run
tts -h
for the full list of commands.
(3B) IN THE BROWSER
- Run
tts-server
in the command line. - After some setup, will show something like
Running on http://[::1]:5002
. - Open browser and access
http://localhost:5002
.
(3C) SIMPLE PYTHON SCRIPT
from TTS.api import TTS
tts = TTS(model_name="tts_models/en/ljspeech/vits", progress_bar=True, gpu=True)
tts.tts_to_file("YES! Text to speech works like magic.", file_path="OUTPUT.wav")
Pretty much ripped from the GitHub page.
(4) INSTALLATION PAINS
(4A) NUMPY NUMBA
- If you get
Failed to initialize NumPy: module compiled against API version
, it's a “version mismatch” issue. - A
pip install --upgrade numpy numba
should do the magic.
(4B) NVIDIA DRIVERS
- Not sure if AMD cards are supported. Nvidia users, try updating your Nvidia driver.
- Rebuild your PyTorch, with CUDA support -
pip install --upgrade torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
. - Worst case, run with
gpu=False
... Slow, but it works.
EXTRAS
That's all for this super compressed guide. Here are a couple of useful links.
- On my gist, I have shared a simple script that converts a text file to narration.
- Coqui TTS Documentation
- Bark Another interesting project... But it kind of suffers from hallucinations.
- Tortoise TTS Another TTS project capable of voice cloning... But slow as a Tortoise. Get it?
- Python Text To Speech - Code Boxx
Top comments (0)