• Stars
    star
    6,243
  • Rank 6,409 (Top 0.2 %)
  • Language
    C++
  • License
    MIT License
  • Created almost 2 years ago
  • Updated 4 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,361
star
2

larynx

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

wyoming-satellite

Remote voice satellite using Wyoming protocol
Python
637
star
4

rhasspy3

An open source voice assistant toolkit for many human languages
Python
300
star
5

gruut

A tokenizer, text cleaner, and phonemizer for many human languages.
Python
278
star
6

wyoming

Peer-to-peer protocol for voice assistants
Python
118
star
7

snowboy-seasalt

Web interface for creating snowboy personal wake words locally
JavaScript
117
star
8

wyoming-openwakeword

Wyoming protocol server for openWakeWord wake word detection system
Python
102
star
9

piper-recording-studio

Local voice recording for creating Piper datasets
JavaScript
95
star
10

piper-phonemize

C++ library for converting text to phonemes for Piper
C++
85
star
11

wyoming-faster-whisper

Wyoming protocol server for faster whisper speech to text system
Python
82
star
12

gruut-ipa

Python library for manipulating pronunciations using the International Phonetic Alphabet (IPA)
Python
78
star
13

wyoming-addons

Docker builds for Home Assistant add-ons using Wyoming protocol
Dockerfile
64
star
14

hassio-addons

Add-ons for Home Assistant's Hass.IO
Dockerfile
62
star
15

rhasspy-silence

Silence detection in audio stream using webrtcvad
Python
46
star
16

rhasspy-wake-raven

Wake word detection engine based on Snips Personal Wakeword Detector
Python
44
star
17

wyoming-piper

Wyoming protocol server for Piper text to speech system
Python
39
star
18

pymicro-vad

Self-contained voice activity detector
C++
22
star
19

espeak-phonemizer

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

piper-sample-generator

Generate samples using Piper to train wake word models
Python
17
star
21

rhasspy-hermes-app

Helper library to create voice apps for Rhasspy in Python using the Hermes protocol
Python
17
star
22

openWakeWord-cpp

C++ version of openWakeWord
C++
17
star
23

pl_deepspeech-jaco

Polish profile for Rhasspy using Jaco's DeepSpeech model
Python
16
star
24

wyoming-snowboy

Wyoming protocol server for snowboy wake word detection system
Python
16
star
25

webrtc-noise-gain

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

rhasspy-asr-kaldi

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

fa_kaldi-rhasspy

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

rhasspy-speakers-cli-hermes

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

glow-tts-train

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

phonetisaurus-pypi

Python wrapper for phonetisaurus grapheme to phoneme tool
Python
12
star
31

glow-speak

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

rhasspy-microphone-cli-hermes

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

larynx_old

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

wyoming-snd-external

Wyoming protocol server that calls an external program to play audio
Python
11
star
35

rhasspy-nlu

Natural language understanding library for Rhasspy
Python
11
star
36

wyoming-whisper-cpp

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

wyoming-porcupine1

Wyoming protocol server for porcupine1 wake word detection system
Python
10
star
38

pysilero-vad

Mike/Projects/pysilero-vad.git
Python
10
star
39

rhasspy-satellite

Collection of Rhasspy libraries for satellites only
Shell
9
star
40

snowman-enroll

Custom wake word creation for snowboy using snowman
C++
9
star
41

tts-prompts

Phonetically balanced text to speech sentences
9
star
42

wyoming-vosk

Wyoming protocol server for the vosk speech to text system
Python
9
star
43

wyoming-mic-external

Wyoming protocol server that calls an external program to get microphone input
Python
9
star
44

rhasspy-client

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

ipa2kaldi

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

kaldi-align

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

hifi-gan-train

Implementation of Hi-Fi GAN vocoder
Python
6
star
48

fr_kaldi-rhasspy

French Kaldi profile for Rhasspy built from open speech data
Python
6
star
49

cs_kaldi-rhasspy

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

it_kaldi-rhasspy

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

sv_kaldi-rhasspy

Swedish Kaldi profile for Rhasspy built from open speech data
Python
6
star
52

rhasspy-microphone-pyaudio-hermes

MQTT service for audio input from PyAudio using Hermes protocol
Shell
6
star
53

wav2mel

Transform audio files into mel spectrograms for text-to-speech model training
Python
6
star
54

phonemes2ids

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

rhasspy-tts-cli-hermes

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

pyspeex-noise

Noise suppression and automatic gain with speex
C++
5
star
57

piper-samples

Samples for Piper text to speech system
Python
5
star
58

rhasspy-asr-deepspeech-hermes

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

dataset-voice-kerstin

Voice dataset for native female German speaker
5
star
60

wyoming-handle-external

Wyoming protocol server that calls an external program to handle intents
Python
4
star
61

de_larynx-thorsten

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

vits-train

Training for VITS text to speech system
Python
4
star
63

rhasspy-server-hermes

Web server interface to Rhasspy with Hermes back-end
JavaScript
4
star
64

wiktionary2dict

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

nl_larynx-rdh

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

es_kaldi-rhasspy

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

ru_kaldi-rhasspy

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

es_larynx-css10

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

rhasspy-rasa-nlu-hermes

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

vox-check

Website for contributing voice recordings and vertifications
JavaScript
3
star
71

energy-vad

Energy-based voice activity detector with no dependencies
Python
3
star
72

wyoming-microwakeword

Wyoming server for microWakeWord
Python
2
star
73

voicekit-fpc

False positive detector for the Voice Kit
C++
2
star
74

rhasspy-hermes

Python classes for Hermes protocol
HTML
2
star
75

rhasspy-asr-pocketsphinx

Speech to text for Rhasspy using Pocketsphinx
Python
2
star
76

speexdsp-cli

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

bemused-client

Streaming TFLite keyword detector
Python
2
star
78

rhasspy-homeassistant-hermes

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

es_deepspeech-jaco

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

ru_larynx-nikolaev

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

pymicro-features

Get audio features for microWakeWord and microVAD
C
1
star
82

wyoming-sdl2

Wyoming protocol server for audio input/output with SDL2
Python
1
star
83

unicode-rbnf

A pure Python implementation of ICU's rule-based number format engine
Python
1
star
84

en-us_larynx-kathleen

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

rhasspy-web-vue

Vue-based web interface to Rhasspy
JavaScript
1
star
86

mitlm

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

rhasspy-wake-porcupine-hermes

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

rhasspy-asr-deepspeech

Rhasspy wrapper for Deepspeech ASR
Python
1
star
89

rhasspy-python-template

Template for Rhasspy repositories with Python code
1
star
90

rhasspy-asr-vosk-hermes

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

ar_kaldi-rhasspy

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

models

Centralized place to store model files
1
star
93

rhasspy-tag-action

Python
1
star
94

rhasspy-wake-precise-hermes

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

rhasspy-skills

Collection of custom skills for Rhasspy
Python
1
star
96

rhasspy-wake-snowboy-hermes

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

rhasspy-remote-http-hermes

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

rhasspy-junior

A single-file voice assistant framework
Python
1
star
99

rhasspy-tts-wavenet-hermes

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

rhasspy-profile

Python library for Rhasspy settings
Python
1
star