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.
- 日本語の事前学習及び追加学習/推論対応(OpenJTalk統合)
- 詳細な使用方法は日本語音声合成ガイドを参照
- GitHub Actionsによる以下のプラットフォームのビルドおよびバイナリー配布の自動化
ダウンロードしたバイナリを初めて実行する際、macOSのセキュリティ機能により警告が表示される場合があります。以下のコマンドで検疫属性を削除してください:
# ダウンロードしたファイルを展開後
xattr -cr piper/
# または特定のバイナリのみ
xattr -cr piper/bin/piper
これにより、Gatekeeperの警告なしに実行できるようになります。
- Linux (amd64, arm64)
- macOS (x64, arm64)
- Windows (x64)
- 注: ARMv7 (32ビット) はサポート終了。Raspberry Pi 3以降はARM64版をご利用ください
- 前処理済み .pt ファイルが破損していても学習時に自動スキップして継続できるように改善
- DataLoader に
pin_memory=True
を設定し GPU 転送を最適化 preprocess.py
に--timeout-seconds
を追加し、ハングする発話を自動タイムアウト/スキップpiper_train
に--num-workers
を追加し、DataLoader のワーカー数をコマンドラインから指定可能にpiper_train
に--save-top-k
を追加し、チェックポイント保存個数をコマンドラインから指定可能に- PyPI パッケージ
piper-tts-plus
として公開し、pip install
で簡単インストール可能に
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
Voices are trained with VITS and exported to the onnxruntime.
Our goal is to support Home Assistant and the Year of Voice.
Download voices for the supported languages:
- العربية, Jordan (Arabic, ar_JO)
- Català, Spain (Catalan, ca_ES)
- Čeština, Czech Republic (Czech, cs_CZ)
- Cymraeg, Great Britain (Welsh, cy_GB)
- Dansk, Denmark (Danish, da_DK)
- Deutsch, Germany (German, de_DE)
- Ελληνικά, Greece (Greek, el_GR)
- English, Great Britain (English, en_GB)
- English, United States (English, en_US)
- Español, Spain (Spanish, es_ES)
- Español, Mexico (Spanish, es_MX)
- فارسی, Iran (Farsi, fa_IR)
- Suomi, Finland (Finnish, fi_FI)
- Français, France (French, fr_FR)
- Magyar, Hungary (Hungarian, hu_HU)
- íslenska, Iceland (Icelandic, is_IS)
- Italiano, Italy (Italian, it_IT)
- ქართული ენა, Georgia (Georgian, ka_GE)
- қазақша, Kazakhstan (Kazakh, kk_KZ)
- Lëtzebuergesch, Luxembourg (Luxembourgish, lb_LU)
- Latviešu, Latvia (Latvian, lv_LV)
- മലയാളം, India (Malayalam, ml_IN)
- नेपाली, Nepal (Nepali, ne_NP)
- Nederlands, Belgium (Dutch, nl_BE)
- Nederlands, Netherlands (Dutch, nl_NL)
- Norsk, Norway (Norwegian, no_NO)
- Polski, Poland (Polish, pl_PL)
- Português, Brazil (Portuguese, pt_BR)
- Português, Portugal (Portuguese, pt_PT)
- Română, Romania (Romanian, ro_RO)
- Русский, Russia (Russian, ru_RU)
- Slovenčina, Slovakia (Slovak, sk_SK)
- Slovenščina, Slovenia (Slovenian, sl_SI)
- srpski, Serbia (Serbian, sr_RS)
- Svenska, Sweden (Swedish, sv_SE)
- Kiswahili, Democratic Republic of the Congo (Swahili, sw_CD)
- Türkçe, Turkey (Turkish, tr_TR)
- украї́нська мо́ва, Ukraine (Ukrainian, uk_UA)
- Tiếng Việt, Vietnam (Vietnamese, vi_VN)
- 简体中文, China (Chinese, zh_CN)
You will need two files per voice:
- A
.onnx
model file, such asen_US-lessac-medium.onnx
- A
.onnx.json
config file, such asen_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!
You can run Piper with Python or download a binary release:
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
).
- Download a voice and extract the
.onnx
and.onnx.json
files - 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.
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.
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)
- Name of the speaker to use from
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" }
Piper has been used in the following projects/papers:
- Home Assistant
- Rhasspy 3
- NVDA - NonVisual Desktop Access
- Image Captioning for the Visually Impaired and Blind: A Recipe for Low-Resource Languages
- Open Voice Operating System
- JetsonGPT
- LocalAI
- Lernstick EDU / EXAM: reading clipboard content aloud with language detection
- Natural Speech - A plugin for Runelite, an OSRS Client
- mintPiper
- Vim-Piper
See the training guide and the source code.
Pretrained checkpoints are available on Hugging Face
See src/python_run
Install with pip
:
# 基本機能のみ
pip install piper-tts-plus
# GPU 版 (CUDA 環境がある場合)
pip install "piper-tts-plus[gpu]"
# HTTP サーバー機能を含む場合
pip install "piper-tts-plus[http]"
# GPU + HTTP
pip install "piper-tts-plus[gpu,http]"
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.