Skip to content

TTS ‐ piper‐http

Jdaie edited this page Mar 4, 2026 · 8 revisions

Piper is offical supported running as a local HTTP service. Comparing to using piper in command line mode, the HTTP server mode is more efficient and faster since it avoids the repeated model loading time for every TTS request.

More details can be found in the piper-tts GitHub repository

Install piper and web server

You can install using pip:

# if you have piper installed before, skip this line
# the latest piper version 1.4.0 is not working. I'm using 1.3.0 here.
pip install -U piper-tts==1.3.0 --break-system-packages

pip install -U piper-tts[http] --break-system-packages

Download a voice, for example, the "en_US-amy-medium" voice:

mkdir -p ~/piper
cd ~/piper
python3 -m piper.download_voices en_US-amy-medium

The model will be downloaded to /home/pi/piper in this case.

Test piper HTTP server

If you set piper-http as your TTS_SERVER in the .env file, the chatbot program will start the piper HTTP server automatically when you start the chatbot.

These commands are just for testing the piper HTTP server to make sure everything is working fine.

python3 -m piper.http_server -m en_US-amy-medium --port 8805

use another terminal to test the server:

curl -X POST -H 'Content-Type: application/json' -d '{ "text": "This is a test." }' -o test.wav localhost:8805

You should hear the TTS audio in test.wav.

aplay test.wav

Configure Whisplay AI Chatbot to use piper-http

.env file settings:

TTS_SERVER=piper-http

## Piper HTTP TTS
# if you are using piper-http as TTS server, the server will be hosted at localhost:8805 by default
# installation command: `python3 -m pip install piper-tts[http] --break-system-packages`

# PIPER_HTTP_HOST=localhost
# PIPER_HTTP_PORT=8805

# specify the voice model to use, you should download it beforehand, use this command to download a model: `python3 -m piper.download_voices en_US-amy-medium`

PIPER_HTTP_MODEL=/home/pi/piper/en_US-amy-medium

# specify the speech speed, default is 1. The larger the value, the slower the speech.

PIPER_HTTP_LENGTH_SCALE=1

Clone this wiki locally