English | 日本語
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.
🎙️ Try Piper TTS Demo on Hugging Face - Experience Japanese and English text-to-speech in your browser!
- 🌐 WebUI (Gradio) - ブラウザベースの使いやすいインターフェース
- 🚀 オンラインデモ - Hugging Face Spacesで今すぐ試せます!
- 🌏 WebAssemblyデモ - ブラウザで動作する日本語TTSデモ(サーバー不要)
- 詳細はWebUI使用ガイドを参照
- 推論と学習の両方に対応
- 多言語テンプレートシステム(日本語、英語、ドイツ語、フランス語)
- Docker対応で簡単デプロイ
- 使用例: python -m piper.webui --data-dir ./models
 
- 🎤 音素入力機能 - [[ phonemes ]]記法による直接音素指定- 詳細は音素入力ガイドを参照
- 使用例: echo "Hello [[ h ə l oʊ ]] world" | piper --model en.onnx -f out.wav
- 日本語例: echo "今日は [[ ky o o w a ]] です" | piper --model ja.onnx -f out.wav
 
- 📚 カスタム辞書機能 - 技術用語や固有名詞の読みを正確に制御
- 詳細はカスタム辞書ガイドを参照
- 200以上の技術用語を含むデフォルト辞書(Docker→ドッカー、GitHub→ギットハブ等)
- 使用例: echo "DockerとGitHubを使います" | piper --model ja.onnx --custom-dict my_dict.json -f out.wav
- Python/C++両対応、複数辞書の同時使用可能
 
- 日本語の事前学習及び追加学習/推論対応(OpenJTalk統合)
- 詳細な使用方法は日本語音声合成ガイドを参照
- Windows対応: Windowsセットアップガイドを参照
- API ドキュメント: OpenJTalk API リファレンスを参照
- PUA音素マッピングによる日本語TTS精度向上 - 技術詳細を参照
- 自動ダウンロード機能: 初回実行時に必要な辞書とHTSボイスファイルを自動ダウンロード
- 環境変数(オプション):
- OPENJTALK_DICTIONARY_DIR: OpenJTalk辞書へのパス(未設定時は自動ダウンロード)
- OPENJTALK_VOICE: HTSボイスモデル(.htsvoice)へのパス(未設定時は自動ダウンロード)
- PIPER_AUTO_DOWNLOAD_DICT:- 0に設定すると自動ダウンロードを無効化
- PIPER_OFFLINE_MODE:- 1に設定するとオフラインモード(ネットワーク接続不要)
 
- 既存の日本語モデルは再学習不要 - 設定ファイルの更新のみで対応可能
 
- GitHub Actionsによる自動ビルドとバイナリー配布(詳細はプラットフォームサポートを参照)
- 前処理済み .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で簡単インストール可能に
- 多言語TTSテストインフラストラクチャーを追加し、CI/CDで自動テスト実行 - 詳細
- OpenJTalk辞書とHTSボイスモデルの自動ダウンロード機能を追加し、日本語TTSのセットアップを簡略化
- 🌏 WebAssembly対応 - ブラウザで直接動作する日本語TTS実装
- OpenJTalk WebAssembly版による日本語音素化
- ONNX Runtime WebAssemblyによるニューラル音声合成
- サーバー不要で完全にブラウザ内で動作
- コンパクトサイズ: WASM < 400KB、JS < 40KB
- 詳細: OpenJTalk WebAssembly README
 
- 🎯 音声品質向上機能
- EMA (Exponential Moving Average): 学習安定性とファインチューニング品質向上(デフォルトで有効)
- カスタム辞書機能: 日本語発音の精度向上(478エントリの発音辞書を標準搭載)
- 効果: 学習の安定性向上、日本語複合語の正確な発音
- 詳細: EMA実装ドキュメント
 
- マルチGPU学習対応(PyTorch Lightning 2.4.0)
- DDP (Distributed Data Parallel) 戦略による複数GPU並列学習
- 学習率の自動スケーリング機能(--auto_lr_scaling)
- コード品質向上(セキュリティ強化、分散ログ最適化)
- 使用例:
python -m piper_train \ --dataset-dir /path/to/dataset \ --batch-size 64 \ --devices 4 \ --strategy ddp_find_unused_parameters_true \ --ema-decay 0.9995 \ --num-workers 80 # 注: --auto_lr_scaling はデフォルトで有効 # EMAもデフォルトで有効、--no-emaで無効化可能 
 
- チェックポイント管理機能の強化
- --resume_from_checkpointでチェックポイントからの学習再開
- --resume_from_single_speaker_checkpointでシングルスピーカーモデルからマルチスピーカーへの変換
 
- GPU推論サポート(C++バイナリ)
- --use-cudaオプションでONNX Runtime CUDAプロバイダーを有効化
 
- 学習時の高度なオプション
- --gradient_clip_val- 勾配クリッピング
- --accumulate_grad_batches- 勾配累積によるバッチサイズ仮想拡張
- --precision- Mixed Precision Training対応(16-mixed等)
- --detect_anomaly- 学習時の異常検出機能
 
- 音声評価ツール(scripts/evaluation/)- MCD (Mel-Cepstral Distortion) 評価
- PESQ (Perceptual Evaluation of Speech Quality) 評価
- UTMOS評価
 
- 🎵 CLI機能強化 - 詳細ドキュメント
- 音量調整: --volumeオプション (0.1-2.0)
- 自動再生: --auto-playで生成後自動再生
- 直接テキスト入力: piper "テキスト" --model model.onnx
- ファイル入力: --input-fileで複数ファイル対応
- 使用例:
# 音量調整付き自動再生 piper "こんにちは" --model ja_JP-test.onnx --volume 1.2 --auto-play # ファイルから読み込み piper --model en_US-lessac.onnx --input-file story.txt -f output.wav 
 
- 音量調整: 
- 🎯 音素タイミング情報出力 - 詳細ドキュメント
- リップシンク、カラオケ、字幕同期用のタイミング情報
- JSON/TSV形式での出力
- 使用例:
echo "Hello world" | piper --model en_US-lessac.onnx \ --output-file speech.wav --output-timing timing.json 
 
echo 'Welcome to the world of speech synthesis!' | \
  ./piper --model en_US-lessac-medium.onnx --output_file welcome.wav
# Streaming mode for reduced latency (outputs audio chunks progressively)
echo 'This is a long text that will be processed in chunks for lower latency.' | \
  ./piper --model en_US-lessac-medium.onnx --output_file output.wav --streamingThe --streaming flag enables chunk-based processing for reduced latency:
- Dynamic chunk sizing: Automatically adjusts chunk size based on punctuation density
- Audio crossfading: Smooth transitions between chunks to prevent clicks/artifacts
- ~15% latency reduction for long texts
Listen to voice samples and check out a video tutorial by Thorsten Müller
Voices are trained with VITS and exported to the onnxruntime.
| プラットフォーム | アーキテクチャ | OpenJTalk対応 | 備考 | 
|---|---|---|---|
| Linux | x86_64 (amd64) | ✅ | フルサポート | 
| Linux | ARM64 | ✅ | フルサポート (CMakeビルド使用) | 
| macOS | ARM64 (Apple Silicon)のみ | ✅ | M1/M2/M3以降のMac専用 | 
| Windows | x64 | ✅ | フルサポート | 
| Web (ブラウザ) | WebAssembly | ✅ | Chrome/Edge/Firefox/Safari対応 | 
2024年より、macOSではApple Silicon (M1/M2/M3以降) のみをサポートしています。
Intel Mac (x86_64) のサポートは終了しました。以下の代替方法をご利用ください:
- 
Dockerを使用(推奨) # Dockerイメージをプル docker pull ghcr.io/ayutaz/piper-plus:latest # 実行例 docker run --rm -v $(pwd):/data ghcr.io/ayutaz/piper-plus:latest \ echo "Hello from Docker" | piper --model /data/model.onnx --output_file /data/output.wav 
- 
ソースからビルド # 依存関係をインストール brew install cmake onnxruntime # ビルド git clone https://github.com/ayutaz/piper-plus.git cd piper-plus mkdir build && cd build cmake .. -DCMAKE_BUILD_TYPE=Release make -j$(sysctl -n hw.ncpu) 
- 
仮想マシンでLinux版を使用 - UTM、Parallels Desktop、VMware Fusionなどを使用
 
通常通りダウンロードしてご利用いただけます。初回実行時のセキュリティ警告については、以下をご参照ください。
ダウンロードしたバイナリを初めて実行する際、macOSのセキュリティ機能により警告が表示される場合があります。以下のコマンドで検疫属性を削除してください:
# ダウンロードしたファイルを展開後
xattr -cr piper/
# または特定のバイナリのみ
xattr -cr piper/bin/piper
xattr -cr piper/bin/open_jtalk  # 日本語TTSを使用する場合これにより、Gatekeeperの警告なしに実行できるようになります。
Piper-plusはWebAssemblyを使用してブラウザで直接動作します:
- 完全ブラウザ動作: サーバー不要、オフライン対応
- 日本語対応: OpenJTalk WebAssembly版による高精度な音素化
- 軽量: WASM < 400KB、JS < 40KB
- 対応ブラウザ: Chrome、Edge、Firefox、Safari(最新版)
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, Argentina (Spanish, es_AR)
- 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)
- हिंदी, India (Hindi, hi_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 .onnxmodel file, such asen_US-lessac-medium.onnx
- A .onnx.jsonconfig 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!
Piper has different requirements depending on your use case:
# For inference only (using pre-trained models)
pip install -r requirements.txt
# For training custom models
pip install -r requirements-train.txt
# For development (includes testing and linting tools)
pip install -r requirements-dev.txtThe easiest way to get started with Piper is using the WebUI:
# Install inference dependencies first
pip install -r requirements.txt
# Install WebUI dependencies
pip install gradio>=4.0.0
# Run WebUI
cd src/python_run
python -m piper.webui --data-dir /path/to/modelsOr using Docker:
# Run with Docker
docker run -p 7860:7860 -v ./models:/models ghcr.io/rhasspy/piper-webuiAccess the WebUI at http://localhost:7860
You can run Piper with Python or download a binary release:
If you want to build from source, see the CMakeLists.txt and C++ source.
- C++ compiler with C++17 support
- CMake 3.13 or later
- Git
- 
Clone the repository: git clone https://github.com/rhasspy/piper.git cd piper
- 
Create build directory: mkdir build cd build
- 
Configure and build: cmake .. cmake --build . --config Release
Linux: 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.
Windows: See the Windows Setup Guide for detailed instructions.
macOS: The build process will automatically download required dependencies.
- Download a voice and extract the .onnxand.onnx.jsonfiles
- Run the piperbinary 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.wavFor multi-speaker models, use --speaker <number> to change speakers (default: 0).
- --use-cuda- Enable GPU acceleration with CUDA
- --gpu-device-id <number>- GPU device ID for CUDA (default: 0)
- --quiet/- -q- Disable logging output
- --phoneme-silence <phoneme> <seconds>- Set silence duration for specific phonemes
- --length-scale <value>- Adjust speech speed (default: 1.0, smaller = faster)
- --noise-scale <value>- Control audio variation (default: 0.667)
- --noise-w <value>- Control phoneme duration variation (default: 0.8)
- --sentence-silence <seconds>- Silence between sentences (default: 0.2)
- --raw-phonemes- Interpret input as raw phonemes (space-separated)
See piper --help for more options.
Piper supports two methods for direct phoneme input:
- 
Inline phoneme notation - Mix text with phonemes using [[ ]]:echo 'Hello [[ h ə l oʊ ]] world' | ./piper --model en_US-lessac-medium.onnx -f output.wav 
- 
Raw phoneme mode - Input only phonemes with --raw-phonemes:echo 'h ə l oʊ _ w ɜː l d' | ./piper --model en_US-lessac-medium.onnx --raw-phonemes -f output.wav 
See raw-phoneme-input.md for detailed documentation.
If you encounter the error "Could not find espeak-ng-data directory" on Windows:
- 
Check Directory Structure: Ensure your Piper installation has the following structure: piper/ ├── piper.exe ├── espeak-ng.dll ├── piper_phonemize.dll └── espeak-ng-data/ # This directory must be present └── phontab # This file must exist
- 
Alternative Locations: The program also searches for espeak-ng-datain:- ../share/espeak-ng-data(relative to piper.exe)
- Standard eSpeak NG installation paths
 
- 
Manual Configuration: If the automatic detection fails, you can: - Set the ESPEAK_DATA_PATHenvironment variable:set ESPEAK_DATA_PATH=C:\path\to\espeak-ng-data piper.exe --model en_US-lessac-medium.onnx -f output.wav 
- Or use the --espeak_datacommand-line option:piper.exe --espeak_data C:\path\to\espeak-ng-data --model en_US-lessac-medium.onnx -f output.wav 
 
- Set the 
- 
Download Missing Data: If espeak-ng-datais missing from your distribution:- Download it from the official releases
- Extract it to the same directory as piper.exe
 
For more Windows-specific information, see the Windows Setup Guide.
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_mapin 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
PiperをUnityで使用するためのプラグイン「uPiper」が開発されています:
- GitHub: https://github.com/ayutaz/uPiper
- Unity 6000.0.35f1以降対応
- Unity.InferenceEngineを使用したONNXモデル実行
- 非同期APIとストリーミングサポート
- 現在は日本語と英語に対応(他言語は今後対応予定)
- 対応プラットフォーム:
- Windows (x64)
- macOS (Apple Silicon対応、IntelはDocker環境でのみ)
- Linux (x64)
- Android (ARM64)
- iOS(未対応)
- WebGL(計画中)
 
uPiperは、ゲーム開発やインタラクティブアプリケーションでPiper TTSを活用するための包括的なソリューションを提供します。
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-gpuand 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.
For detailed documentation, see the docs/ directory.
See CONTRIBUTING.md for guidelines on how to contribute to this project.
See CHANGELOG.md for version history and release notes.

