05 Nov 2026 · ia, voz · 5 min
piper: text to speech running on your own machine
Piper is a neural text-to-speech engine that runs on your machine, no GPU and no internet after the download. You feed it text, it returns a WAV file. The voice weighs 61 MB and a three-second sentence comes out in 0.63 s.
The project started as rhasspy/piper (MIT license). Development moved to OHF-Voice/piper1-gpl (GPL-3.0). The voices, in the rhasspy/piper-voices repository on Hugging Face, are MIT. For commercial use, check the license of the binary you ship.
The script below downloads the pt_BR-faber-medium voice, generates audio for three sentences, and prints the size and time of each. If piper is not installed, it prints the instructions and exits without error.
#!/usr/bin/env bash
# piper-generate.sh
# Download a pt_BR voice and generate audio for sample sentences.
set -u
VOICE="${VOICE:-pt_BR-faber-medium}"
VOICE_URL="https://huggingface.co/rhasspy/piper-voices/resolve/main/pt/pt_BR/faber/medium"
DEST="${DEST:-./piper-voices}"
PIPER_BIN="${PIPER_BIN:-piper}"
if ! command -v "$PIPER_BIN" >/dev/null 2>&1 && [ ! -x "./piper/piper" ]; then
echo "piper not found."
echo "Download the binary from https://github.com/rhasspy/piper/releases (piper_linux_x86_64.tar.gz)"
echo "Extract into ./piper and run again."
echo "Voices at https://huggingface.co/rhasspy/piper-voices"
exit 0
fi
[ -x "./piper/piper" ] && PIPER_BIN="./piper/piper"
mkdir -p "$DEST"
ONNX="$DEST/$VOICE.onnx"
JSON="$DEST/$VOICE.onnx.json"
if [ ! -f "$ONNX" ]; then
if command -v wget >/dev/null 2>&1; then
wget -q "$VOICE_URL/pt_BR-faber-medium.onnx" -O "$ONNX"
wget -q "$VOICE_URL/pt_BR-faber-medium.onnx.json" -O "$JSON"
else
echo "wget not found; download the voice manually into $DEST"
exit 0
fi
fi
for i in 1 2 3; do
case $i in
1) sentence="Hello, this is a local text to speech test with Piper." ;;
2) sentence="Inference speed is measured by the real-time factor." ;;
3) sentence="Piper runs on a regular CPU, no GPU and no internet after download." ;;
esac
output="$DEST/sentence-$i.wav"
echo "=== sentence $i ==="
echo "$sentence"
echo "$sentence" | "$PIPER_BIN" --model "$ONNX" --output_file "$output" 2>&1 | tail -3
ls -lh "$output"
done
How to verify
Run echo "test" | piper --model voice.onnx --output_file test.wav and check ls -lh test.wav. In the measurement above, a three-second sentence produced 142 KB. The piper log prints Real-time factor: 0.066, meaning inference took 6.6% of the audio duration. To inspect the file: ffprobe test.wav or file test.wav.
If it goes wrong
command not found: piper: the binary is not on PATH or was not extracted. Cause: incomplete install. Fix: extract the tar.gz and call ./piper/piper, or add the folder to PATH.
Missing .onnx.json file: piper fails to load the voice. Cause: partial download. Fix: download both files, .onnx and .onnx.json, from the same voice folder on Hugging Face.
Audio with clicks or cut off: sentence too long or missing punctuation. Cause: the model loses cadence on long text. Fix: split into shorter sentences and use punctuation.
Piper or cloud service
| Piper (local) | Cloud service | |
|---|---|---|
| Cost | free | per character or per minute |
| Privacy | text never leaves the machine | text is sent to the API |
| Latency | offline, no network | depends on the network |
| Quality | good for reading, fixed voice | usually better, many voices |
| Setup | binary plus one voice | API key |
Frequently asked questions
Does it work in Portuguese? Yes. There are pt_BR voices in the repository: cadu, edresson, faber and jeff, in low and medium quality.
Does it need a GPU? No. The test ran on a regular CPU, with the voice loading in about 0.3 s.
Can I use it commercially? The voices are MIT. The rhasspy/piper binary is MIT; the current version (OHF-Voice/piper1-gpl) is GPL-3.0. Check the license of the binary you distribute.
What output format? WAV in PCM. For MP3 or OGG, convert with ffmpeg -i output.wav output.mp3.
How fast is it? In the test, a real-time factor of 0.06, meaning synthesis was about 15 times faster than the audio duration. Longer sentences take more, but still under a second for up to two lines of text.
Voices and languages
The voice repository has 35 languages. For Brazilian Portuguese, four voices: cadu, edresson, faber and jeff. Qualities are low and medium. Low is faster and smaller (around 20 MB), medium sounds more natural and weighs around 60 MB. For an assistant that reads notifications, low is enough. For audiobook, medium is the minimum.
Perceived quality depends more on the text than on the voice. Punctuation, commas and line breaks guide prosody. Text without punctuation comes out monotone. Text with abbreviations (Dr., Mr., km/h) comes out wrong, because the model reads letter by letter. Expand abbreviations before synthesizing.
Integrating with the rest of the chain
Piper outputs WAV. To send over Telegram or publish on the web, convert to OGG or MP3 with ffmpeg: ffmpeg -i output.wav -c:a libopus -b:a 24k output.ogg. Opus at 24 kbps keeps intelligibility and shrinks the file by 10 times.
To dub a video, generate audio sentence by sentence and assemble the track with ffmpeg, adjusting speed with atempo when the synthesized sentence is longer than the available slot. For accessibility, combine with a transcriber: the same text that goes to Piper can go to captions.
Privacy and cost
The central advantage is that the text never leaves the machine. For sensitive text (internal documents, meeting transcripts, customer data), that matters more than quality. The cost is zero after the download, with no quota, request limit or price change.
The downside is that you maintain the binary and the voice updates. Piper stopped receiving updates in the original repository; the continuation is OHF-Voice/piper1-gpl. If you need long-term support, follow that repository.
Hardware
The test ran on a regular CPU, no GPU. The voice loaded in about 0.3 s and inference was 15 times faster than the audio. For long text (a book chapter), process paragraph by paragraph and concatenate the WAVs, because memory grows with text size.
On machines with little RAM, the medium voice (60 MB) plus the runtime (around 30 MB) fit without issue. There is no need for dedicated swap for this.
Sources
- rhasspy/piper, binary 1.2.0, MIT license, development moved to OHF-Voice/piper1-gpl (GPL-3.0).
- rhasspy/piper-voices, voices in 35 languages, MIT license.
See also running a model on CPU with llama.cpp, cost per AI consumer and model quantization: what changes.