🍎 Instalacao do Piper TTS no macOS — 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, sem enviar dados para a nuvem. Ele usa o espeak-ng para fonemização e funciona nativamente no macOS (Intel e Apple Silicon).
Suporta mais de 40 idiomas, incluindo Portugues do Brasil (pt_BR), com vozes de alta qualidade.
Instalacao no macOS1️⃣ Instalar Python 3.9+
Opcao A — Homebrew (recomendado):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" brew install [email protected]Opcao B — Python Oficial:
Baixe o instalador em python.org/downloads e execute o .pkg.Verifique a instalacao:
python3 --version pip3 --version
2️⃣ Instalar o Piper
pip3 install piper-tts
Recomendacao: Use um ambiente virtual: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 especifica:
# Portugues brasileiro python3 -m piper.download_voices pt_BR-edresson-medium # Ingles americano python3 -m piper.download_voices en_US-lessac-mediumVozes disponiveis 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 pelos alto-falantes:
# Instalar ffplay via Homebrew brew install ffmpeg # 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 Mac!", 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("Personalizando a voz...", w, syn_config=syn_config)
6️⃣ Servidor HTTP (uso continuo)
Para usar sem recarregar o modelo a cada frase:
python3 -m piper.http_serverAcesse em: http://localhost:5000
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 no Mac (Apple Silicon)
No macOS com chip Apple Silicon (M1/M2/M3/M4), o Piper ja usa o CoreML do macOS para aceleracao. Instale o onnxruntime-coreml para melhor performance:
pip install onnxruntime-coremlPara verificar se esta usando aceleracao:
from piper import PiperVoice voice = PiperVoice.load("voz.onnx", use_cuda=False) # CoreML e automatico no macOS
8️⃣ Automacao com atalhos do macOS
Crie um atalho no Automator ou use a CLI em scripts:
# Script para ler texto em voz alta TEXT="Notificacao importante do sistema" python3 -m piper -m pt_BR-edresson-medium -- "$TEXT" | ffplay -autoexit -f s16le -ar 22050 -ac 1 -
Dicas para macOS- Apple Silicon (M1-M4): Performance excelente -- uma frase de 10 palavras leva menos de 1 segundo
- Intel Mac: Tambem funciona bem, apenas um pouco mais lento em modelos medium/large
- Integracao com Home Assistant: O Piper funciona como servo TTS externo no macOS
- Formatos de audio: O Piper gera WAV nativamente; converta com ffmpeg para MP3, AAC, etc.
- Binarios estaticos: Build manual disponivel em github.com/OHF-Voice/piper1-gpl
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