Sign inSign up

thedayowl/piper-proxy

By thedayowl

Updated over 1 year ago

Web service that works with linuxserver/piper docker container for simple TTS to MP3/WAV generation

Image
0

288

thedayowl/piper-proxy repository overview

Runs a web service that takes a JSON POST payload with parameters "text" and optionally "voice", "speaker" and "output_format". By default Outputs a MP3 file.

"output_format" can be one of: "mp3", "wav" or "wav8k". "wav" outputs a mono WAV file at the same bitrate as the selected voice. "wav8k" outputs WAV downsampled to 16-bit, mono, 8kHz signed linear PCM, perfect for telephony applications.

"speaker" is used to select the speaker on voices that have more than one, like "en_US-libritts_r-medium"

A JSON list of voices can be retrieved using the /voices URL path.

Samples of Piper voices are available at https://rhasspy.github.io/piper-samples/

Separately, install container linuxserver/piper and configure it.

Set ENV variable PIPER_HOST and PIPER_PORT to the host and port that the linuxserver/piper docker container is running on

By default, the web service listens on port 8000. If needed, modify the mapped port to an unused port on your docker host using -p <new port>:8000 in the docker run command.

example docker run:

docker run -d -e PIPER_HOST=192.168.1.181 -e PIPER_PORT=10200 -p 8000:8000 --restart unless-stopped --name piper-proxy thedayowl/piper-proxy:latest 

Example CURL command to retrieve MP3 Audio:

curl -X POST http://localhost:8000/speak \
  -H "Content-Type: application/json" \
  -d '{"text":"Hello world as MP3!", "voice":"en_US-amy-medium"}' \
  --output hello.mp3

Example CURL command to retrieve WAV Audio:

curl -X POST http://localhost:8000/speak \
  -H "Content-Type: application/json" \
  -d '{"text": "Test WAV", "output_format": "wav"}' \
  --output hello.wav

Example CURL command to retrieve 8K PCM WAV:

curl -X POST http://localhost:8000/speak \
  -H "Content-Type: application/json" \
  -d '{"text": "Telephony format", "output_format": "wav8k"}' \
  --output phone.wav

Example CURL command to retrieve a list of voices (in JSON format)

curl http://localhost:8000/voices

Outputs:

{"voices":[
  "ar_JO-kareem-low",
  "ar_JO-kareem-medium",
  "ca_ES-upc_ona-medium",
  "ca_ES-upc_ona-x_low",
  ...
 ]}

Tag summary

Content type

Image

Digest

sha256:ed7e3e1c3

Size

72.4 MB

Last updated

over 1 year ago

docker pull thedayowl/piper-proxy