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.
- Create project folder. E.G.
- Create virtual environment.
- For Windows
- For Linux/Mac
- Download Coqui –
pip install tts
tts --text "YOUR TEXT" --out_path PATH/SPEECH.WAV
tts -hfor the full list of commands.
tts-serverin the command line.
- After some setup, will show something like
Running on http://[::1]:5002.
- Open browser and access
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.
- If you get
Failed to initialize NumPy: module compiled against API version, it's a “version mismatch” issue.
pip install --upgrade numpy numbashould do the magic.
- 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.
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