🐧 Instalacao do Piper TTS no Linux — Guia Passo a Passo
-
️ O que é o Piper TTS?Piper é um motor de texto-para-fala (TTS) rápido, neural e totalmente local — roda 100% offline. Ele usa o espeak-ng para fonemização e funciona em qualquer distribuição Linux.
Suporta mais de 40 idiomas, incluindo Português do Brasil (pt_BR), com vozes de alta qualidade.
Instalação no Linux1️⃣ Instalar Python 3.9+ e 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️⃣ Instalar o Piper
pip install piper-tts
Recomendação: Use um ambiente virtual para evitar conflitos:python3 -m venv piper-env source piper-env/bin/activate pip install piper-tts
3️⃣ Baixar uma voz
python3 -m piper.download_voicesPara baixar uma voz específica:
# Português brasileiro python3 -m piper.download_voices pt_BR-edresson-medium # Inglês americano python3 -m piper.download_voices en_US-lessac-mediumAs vozes ficam disponíveis em huggingface.co/rhasspy/piper-voices.
4️⃣ Testar a Voz
python3 -m piper -m pt_BR-edresson-medium -f teste.wav -- "Ola! Esta e uma mensagem de teste do Piper TTS."Para ouvir diretamente (precisa do ffplay):
# Instalar ffplay sudo apt install ffmpeg # Debian/Ubuntu sudo dnf install ffmpeg # Fedora # Testar python3 -m piper -m pt_BR-edresson-medium -- "Ola, mundo!"
5️⃣ Usar a API Python
import wave from piper import PiperVoice, SynthesisConfig voice = PiperVoice.load("pt_BR-edresson-medium.onnx") with wave.open("saida.wav", "wb") as wav_file: voice.synthesize_wav("Bem-vindo ao Piper TTS no Linux!", wav_file) syn_config = SynthesisConfig( volume=1.0, length_scale=1.1, noise_scale=0.9, normalize_audio=True ) with wave.open("ajustado.wav", "wb") as w: voice.synthesize_wav("Frase personalizada...", w, syn_config=syn_config)
6️⃣ Servidor HTTP (para uso continuo)
Para evitar recarregar o modelo a cada frase, inicie o servidor:
python3 -m piper.http_serverAcesse em: http://localhost:5000
Exemplo com curl:
curl -X POST http://localhost:5000/synthesize \ -H "Content-Type: application/json" \ -d '{"text": "Ola servidor Piper!", "voice": "pt_BR-edresson-medium"}' \ --output audio.wav
7️⃣ Aceleracao GPU (opcional)
Com placa NVIDIA:
pip install onnxruntime-gpu # No codigo voice = PiperVoice.load("voz.onnx", use_cuda=True)
Dicas para Linux- Integracao com Home Assistant: O Piper e o motor TTS padrao do Home Assistant OS
- Automacao: Use piper com scripts de shell para notificacoes por voz
- Vozes em lote: cat frases.txt | python3 -m piper -m voz -f saida.wav
- Binarios nativos (sem Python): Baixe de github.com/rhasspy/piper/releases para amd64/arm64/armv7
Links uteis:
Duvidas? Pergunte aqui!

-
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