You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Go to file
Michael Hansen b0e2b017a9 Update README links 11 months ago
etc More test sentences 11 months ago
lib First working version with libpiper_phonemize 12 months ago
src Fix -f 11 months ago
.dockerignore Fix -f 11 months ago
.gitignore Using patched espeak-ng 1 year ago
.projectile Initial check in of Python training code 2 years ago
Dockerfile Fix -f 11 months ago
LICENSE.md Add license 1 year ago
Makefile Fix -f 11 months ago
README.md Update README links 11 months ago
TRAINING.md Add note for high quality training 11 months ago
VERSION Add "speaker" to JSON input 11 months ago

README.md

Piper logo

A fast, local neural text to speech system that sounds great and is optimized for the Raspberry Pi 4. Piper is used in a variety of projects.

echo 'Welcome to the world of speech synthesis!' | \
  ./piper --model en-us-blizzard_lessac-medium.onnx --output_file welcome.wav

Listen to voice samples and check out a video tutorial by Thorsten Müller

Sponsored by Nabu Casa

Voices are trained with VITS and exported to the onnxruntime.

Voices

Our goal is to support Home Assistant and the Year of Voice.

Download voices for the supported languages:

  • Catalan (ca_ES)
  • Danish (da_DK)
  • German (de_DE)
  • English (en_GB, en_US)
  • Spanish (es_ES, es_MX)
  • Finnish (fi_FI)
  • French (fr_FR)
  • Greek (el_GR)
  • Icelandic (is_IS)
  • Italian (it_IT)
  • Georgian (ka_GE)
  • Kazakh (kk_KZ)
  • Nepali (ne_NP)
  • Dutch (nl_BE, nl_NL)
  • Norwegian (no_NO)
  • Polish (pl_PL)
  • Portuguese (pt_BR)
  • Russian (ru_RU)
  • Swedish (sv_SE)
  • Swahili (sw_CD)
  • Ukrainian (uk_UA)
  • Vietnamese (vi_VN)
  • Chinese (zh_CN)

You will need two files per voice:

  1. A .onnx model file, such as en_US-lessac-medium.onnx
  2. A .onnx.json config file, such as en_US-lessac-medium.onnx.json

The MODEL_CARD file for each voice contains important licensing information. Piper is intended for text to speech research, and does not impose any additional restrictions on voice models. Some voices may have restrictive licenses, however, so please review them carefully!

Installation

Download a release:

  • amd64 (64-bit desktop Linux)
  • arm64 (64-bit Raspberry Pi 4)
  • armv7 (32-bit Raspberry Pi 3/4)

If you want to build from source, see the Makefile and C++ source. You must download and extract piper-phonemize to lib/Linux-$(uname -m)/piper_phonemize before building. For example, lib/Linux-x86_64/piper_phonemize/lib/libpiper_phonemize.so should exist for AMD/Intel machines (as well as everything else from libpiper_phonemize-amd64.tar.gz).

Usage

  1. Download a voice and extract the .onnx and .onnx.json files
  2. Run the piper binary with text on standard input, --model /path/to/your-voice.onnx, and --output_file output.wav

For example:

echo 'Welcome to the world of speech synthesis!' | \
  ./piper --model en_US-lessac-medium.onnx --output_file welcome.wav

For multi-speaker models, use --speaker <number> to change speakers (default: 0).

See piper --help for more options.

JSON Input

The piper executable can accept JSON input when using the --json-input flag. Each line of input must be a JSON object with text field. For example:

{ "text": "First sentence to speak." }
{ "text": "Second sentence to speak." }

Optional fields include:

  • speaker - string
    • Name of the speaker to use from speaker_id_map in config (multi-speaker voices only)
  • speaker_id - number
    • Id of speaker to use from 0 to number of speakers - 1 (multi-speaker voices only, overrides "speaker")
  • output_file - string
    • Path to output WAV file

The following example writes two sentences with different speakers to different files:

{ "text": "First speaker.", "speaker_id": 0, "output_file": "/tmp/speaker_0.wav" }
{ "text": "Second speaker.", "speaker_id": 1, "output_file": "/tmp/speaker_1.wav" }

People using Piper

Piper has been used in the following projects/papers:

Training

See the training guide and the source code.

Pretrained checkpoints are available on Hugging Face

Running in Python

See src/python_run

Run scripts/setup.sh to create a virtual environment and install the requirements. Then run:

echo 'Welcome to the world of speech synthesis!' | scripts/piper \
  --model /path/to/voice.onnx \
  --output_file welcome.wav

If you'd like to use a GPU, install the onnxruntime-gpu package:

.venv/bin/pip3 install onnxruntime-gpu

and then run scripts/piper with the --cuda argument. You will need to have a functioning CUDA environment, such as what's available in NVIDIA's PyTorch containers.