• Stars
    star
    2,862
  • Rank 15,197 (Top 0.4 %)
  • Language
    C++
  • License
    MIT License
  • Created over 1 year ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A fast, local neural text to speech system

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-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)
  • Luxembourgish (lb_LU)
  • Nepali (ne_NP)
  • Dutch (nl_BE, nl_NL)
  • Norwegian (no_NO)
  • Polish (pl_PL)
  • Portuguese (pt_BR)
  • Romanian (ro_RO)
  • Russian (ru_RU)
  • Serbian (sr_RS)
  • Swedish (sv_SE)
  • Swahili (sw_CD)
  • Turkish (tr_TR)
  • 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

You can run Piper with Python or download a binary 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.

Streaming Audio

Piper can stream raw audio to stdout as its produced:

echo 'This sentence is spoken first. This sentence is synthesized while the first sentence is spoken.' | \
  ./piper --model en_US-lessac-medium.onnx --output-raw | \
  aplay -r 22050 -f S16_LE -t raw -

This is raw audio and not a WAV file, so make sure your audio player is set to play 16-bit mono PCM samples at the correct sample rate for the voice.

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

Install with pip:

pip install piper-tts

and then run:

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

This will automatically download voice files the first time they're used. Use --data-dir and --download-dir to adjust where voices are found/downloaded.

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

.venv/bin/pip3 install onnxruntime-gpu

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

More Repositories

1

rhasspy

Offline private voice assistant for many human languages
Shell
2,188
star
2

larynx

End to end text to speech system using gruut and onnx
Python
818
star
3

rhasspy3

An open source voice assistant toolkit for many human languages
Python
256
star
4

gruut

A tokenizer, text cleaner, and phonemizer for many human languages.
Python
248
star
5

wyoming-satellite

Remote voice satellite using Wyoming protocol
Python
197
star
6

snowboy-seasalt

Web interface for creating snowboy personal wake words locally
JavaScript
88
star
7

gruut-ipa

Python library for manipulating pronunciations using the International Phonetic Alphabet (IPA)
Python
69
star
8

piper-recording-studio

Local voice recording for creating Piper datasets
JavaScript
61
star
9

piper-phonemize

C++ library for converting text to phonemes for Piper
C++
52
star
10

rhasspy-silence

Silence detection in audio stream using webrtcvad
Python
45
star
11

wyoming-addons

Docker builds for Home Assistant add-ons using Wyoming protocol
Dockerfile
44
star
12

hassio-addons

Add-ons for Home Assistant's Hass.IO
Dockerfile
42
star
13

rhasspy-wake-raven

Wake word detection engine based on Snips Personal Wakeword Detector
Python
40
star
14

wyoming-openwakeword

Wyoming protocol server for openWakeWord wake word detection system
Python
40
star
15

wyoming

Peer-to-peer protocol for voice assistants
Python
32
star
16

wyoming-faster-whisper

Wyoming protocol server for faster whisper speech to text system
Python
24
star
17

espeak-phonemizer

Uses ctypes and libespeak-ng to transform test into IPA phonemes
Python
19
star
18

rhasspy-hermes-app

Helper library to create voice apps for Rhasspy in Python using the Hermes protocol
Python
16
star
19

pl_deepspeech-jaco

Polish profile for Rhasspy using Jaco's DeepSpeech model
Python
15
star
20

fa_kaldi-rhasspy

Persian Kaldi profile for Rhasspy built from open speech data
Shell
14
star
21

rhasspy-asr-kaldi

Speech to text library for Rhasspy using Kaldi
Python
14
star
22

rhasspy-speakers-cli-hermes

MQTT service for Rhasspy audio output with external program using the Hermes protocol
Python
12
star
23

glow-tts-train

An implementation of GlowTTS designed to work with Gruut
Python
12
star
24

glow-speak

Neural text to speech system that uses eSpeak as a text/phoneme front-end
Python
12
star
25

rhasspy-microphone-cli-hermes

Records audio from an external program and publishes WAV chunks according to the Hermes protocol
Python
12
star
26

larynx_old

Text to speech system based on MozillaTTS and gruut
Python
12
star
27

openWakeWord-cpp

C++ version of openWakeWord
C++
11
star
28

wyoming-snowboy

Wyoming protocol server for snowboy wake word detection system
Python
10
star
29

rhasspy-nlu

Natural language understanding library for Rhasspy
Python
10
star
30

wyoming-piper

Wyoming protocol server for Piper text to speech system
Python
10
star
31

rhasspy-satellite

Collection of Rhasspy libraries for satellites only
Shell
9
star
32

tts-prompts

Phonetically balanced text to speech sentences
8
star
33

rhasspy-client

Client library for talking to remote Rhasspy server
Python
7
star
34

kaldi-align

A basic forced aligner using Kaldi and gruut
Python
7
star
35

hifi-gan-train

Implementation of Hi-Fi GAN vocoder
Python
6
star
36

wyoming-whisper-cpp

Wyoming protocol server for whisper.cpp
C++
6
star
37

cs_kaldi-rhasspy

Czech Kaldi profile for Rhasspy built from open speech data
Python
6
star
38

snowman-enroll

Custom wake word creation for snowboy using snowman
C++
6
star
39

wyoming-porcupine1

Wyoming protocol server for porcupine1 wake word detection system
Python
6
star
40

phonemes2ids

Flexible tool for assigning integer ids to phonemes
Python
6
star
41

it_kaldi-rhasspy

Italian Kaldi profile for Rhasspy built from open speech data
Python
6
star
42

phonetisaurus-pypi

Python wrapper for phonetisaurus grapheme to phoneme tool
Python
6
star
43

ipa2kaldi

Tool for creating Kaldi nnet3 recipes using the International Phonetic Alphabet (IPA)
Python
6
star
44

rhasspy-tts-cli-hermes

MQTT service for text to speech with external program using the Hermes protocol
Shell
6
star
45

fr_kaldi-rhasspy

French Kaldi profile for Rhasspy built from open speech data
Python
5
star
46

sv_kaldi-rhasspy

Swedish Kaldi profile for Rhasspy built from open speech data
Python
5
star
47

rhasspy-microphone-pyaudio-hermes

MQTT service for audio input from PyAudio using Hermes protocol
Shell
5
star
48

piper-samples

Samples for Piper text to speech system
Python
5
star
49

rhasspy-asr-deepspeech-hermes

MQTT service for Rhasspy using Mozilla's DeepSpeech with the Hermes protocol
Python
5
star
50

dataset-voice-kerstin

Voice dataset for native female German speaker
5
star
51

de_larynx-thorsten

German voice for Larynx based on the thorsten dataset
4
star
52

wav2mel

Transform audio files into mel spectrograms for text-to-speech model training
Python
4
star
53

wiktionary2dict

Tool for extracting IPA pronunciations from Wiktionary XML dump
Python
4
star
54

nl_larynx-rdh

Dutch text to speech voice for Larynx built from rdh dataset
3
star
55

piper-sample-generator

Generate samples using Piper to train wake word models
Python
3
star
56

es_kaldi-rhasspy

Spanish Kaldi profile for Rhasspy built from open speech data
Python
3
star
57

ru_kaldi-rhasspy

Russian Kaldi profile for Rhasspy built from open speech data
Python
3
star
58

wyoming-snd-external

Wyoming protocol server that calls an external program to play audio
Python
3
star
59

vits-train

Training for VITS text to speech system
Python
3
star
60

webrtc-noise-gain

Tiny wrapper around webrtc-audio-processing for noise suppression/auto gain only
C++
3
star
61

es_larynx-css10

Spanish text to speech voice for Larynx built from CSS10 corpus
3
star
62

rhasspy-server-hermes

Web server interface to Rhasspy with Hermes back-end
JavaScript
3
star
63

wyoming-mic-external

Wyoming protocol server that calls an external program to get microphone input
Python
3
star
64

rhasspy-rasa-nlu-hermes

MQTT service for natural language understanding in Rhasspy using Rasa NLU with the Hermes protocol
Python
3
star
65

vox-check

Website for contributing voice recordings and vertifications
JavaScript
3
star
66

rhasspy-hermes

Python classes for Hermes protocol
HTML
2
star
67

rhasspy-asr-pocketsphinx

Speech to text for Rhasspy using Pocketsphinx
Python
2
star
68

speexdsp-cli

Tiny program to filter an audio stream through speex for noise suppression
C++
2
star
69

wyoming-handle-external

Wyoming protocol server that calls an external program to handle intents
Python
2
star
70

rhasspy-homeassistant-hermes

MQTT service for handling intents using Home Assistant
Python
2
star
71

bemused-client

Streaming TFLite keyword detector
Python
2
star
72

es_deepspeech-jaco

Spanish profile for Rhasspy using Jaco's DeepSpeech model
Python
2
star
73

ru_larynx-nikolaev

Russian text to speech voice for Larynx built from M-AI Labs corpus
2
star
74

en-us_larynx-kathleen

English voice for Larynx based on the kathleen dataset
1
star
75

rhasspy-web-vue

Vue-based web interface to Rhasspy
JavaScript
1
star
76

mitlm

Modified version of MIT language modeling toolkit
C++
1
star
77

rhasspy-wake-porcupine-hermes

MQTT service for wake word detection using the Hermes protocol
Python
1
star
78

rhasspy-asr-deepspeech

Rhasspy wrapper for Deepspeech ASR
Python
1
star
79

rhasspy-python-template

Template for Rhasspy repositories with Python code
1
star
80

dataset-voice-nathalie

Voice dataset for native female Dutch speaker
1
star
81

rhasspy-asr-vosk-hermes

MQTT service for speech to text with Vosk using Hermes protocol
Python
1
star
82

ar_kaldi-rhasspy

Kaldi profile for Arabic trained from open speech data
Python
1
star
83

models

Centralized place to store model files
1
star
84

rhasspy-tag-action

Python
1
star
85

rhasspy-wake-precise-hermes

MQTT wake word service for Rhasspy with Mycroft Precise using the Hermes protocol
Python
1
star
86

rhasspy-skills

Collection of custom skills for Rhasspy
Python
1
star
87

rhasspy-wake-snowboy-hermes

MQTT service for wake word detection with snowboy using Hermes protocol
Python
1
star
88

rhasspy-remote-http-hermes

MQTT service to use remote Rhasspy server with the Hermes protocol
Python
1
star
89

rhasspy-profile

Python library for Rhasspy settings
Python
1
star
90

rhasspy-tts-wavenet-hermes

MQTT service for text to speech using Google's Wavenet and the Hermes protocol
Python
1
star
91

it_deepspeech-mozillaitalia

Rhasspy profile for Italian based on Mozilla Italia DeepSpeech model
Python
1
star
92

dataset-voice-flemishguy

Voice dataset for native male Dutch speaker
1
star
93

wyoming-vosk

Wyoming protocol server for the vosk speech to text system
Python
1
star
94

pysilero-vad

Mike/Projects/pysilero-vad.git
Python
1
star
95

rhasspy-asr-kaldi-hermes

MQTT service for speech to text with Kaldi using Hermes protocol
Python
1
star
96

rhasspy-asr

Shared Python classes for speech to text
Python
1
star
97

rhasspy-tts-larynx-hermes

MQTT text to speech service based on Larynx using the Hermes protocol
Python
1
star
98

rhasspy-junior

A single-file voice assistant framework
Python
1
star
99

it_deepspeech-jaco

Italian profile for Rhasspy using the Jaco DeepSpeech model
Python
1
star