🐧 Installing Piper TTS on Linux — Step-by-Step Guide
-
️ What is Piper TTS?Piper is a fast, neural text-to-speech engine that runs 100% offline and locally. It uses espeak-ng for phonemization and works on any Linux distribution.
It supports 40+ languages, including Brazilian Portuguese (pt_BR), with high-quality voices.
Installing on Linux1️⃣ Install Python 3.9+ and pip
Debian / Ubuntu / Linux Mint:
sudo apt update sudo apt install python3 python3-pip python3-venv -yFedora / RHEL / CentOS:
sudo dnf install python3 python3-pipArch Linux / Manjaro:
sudo pacman -S python python-pipopenSUSE:
sudo zypper install python3 python3-pip
2️⃣ Install Piper
pip install piper-tts
Recommendation: Use a virtual environment to avoid conflicts:python3 -m venv piper-env source piper-env/bin/activate pip install piper-tts
3️⃣ Download a Voice
python3 -m piper.download_voicesTo download a specific voice:
# Brazilian Portuguese python3 -m piper.download_voices pt_BR-edresson-medium # American English python3 -m piper.download_voices en_US-lessac-mediumVoices are available at huggingface.co/rhasspy/piper-voices.
4️⃣ Test the Voice
python3 -m piper -m pt_BR-edresson-medium -f test.wav -- "Hello! This is a test message from Piper TTS on Linux."To hear it directly (requires ffplay):
# Install ffplay sudo apt install ffmpeg # Debian/Ubuntu sudo dnf install ffmpeg # Fedora # Test python3 -m piper -m pt_BR-edresson-medium -- "Hello, world!"
5️⃣ Using the Python API
import wave from piper import PiperVoice, SynthesisConfig voice = PiperVoice.load("pt_BR-edresson-medium.onnx") with wave.open("output.wav", "wb") as wav_file: voice.synthesize_wav("Welcome to Piper TTS on Linux!", wav_file) syn_config = SynthesisConfig( volume=1.0, length_scale=1.1, noise_scale=0.9, normalize_audio=True ) with wave.open("adjusted.wav", "wb") as w: voice.synthesize_wav("Custom phrase...", w, syn_config=syn_config)
6️⃣ HTTP Server (for continuous use)
To avoid reloading the model for each phrase, start the server:
python3 -m piper.http_serverAccess at: http://localhost:5000
Example with curl:
curl -X POST http://localhost:5000/synthesize \ -H "Content-Type: application/json" \ -d '{"text": "Hello Piper server!", "voice": "pt_BR-edresson-medium"}' \ --output audio.wav
7️⃣ GPU Acceleration (optional)
With an NVIDIA GPU:
pip install onnxruntime-gpu # In code voice = PiperVoice.load("voice.onnx", use_cuda=True)
Linux Tips- Home Assistant Integration: Piper is the default TTS engine in Home Assistant OS
- Automation: Use piper in shell scripts for voice notifications
- Batch processing:
cat phrases.txt | python3 -m piper -m voice -f output.wav - Native binaries (without Python): Download from github.com/rhasspy/piper/releases for amd64/arm64/armv7
Useful links:
Questions? Ask here!

-
R Rodrigo Serpa moved this topic from Getting Started on
-
R Rodrigo Serpa moved this topic from Copy & Paste on
-
R Rodrigo Serpa moved this topic from Getting Started on
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login