日本語を含む6言語対応の軽量TTS「piper-plus」をバイナリファイルから実行して推論する

初めに

スマホやIoTでも動かすことができる日本語を含む6言語対応の軽量TTSのpiper-plusを公開しています 学習も自由にできるようにOSSとして公開しています

github.com

piper-plusはC#,Rust,C++の3言語のバイナリビルドを行っていて任意のファイルから実行することができます

開発環境

  • Windows 11

バイナリのダウンロードと確認

まずは以下のリリースノートからバイナリをダウンロードします

github.com

どれでもほぼ同じなので、今回はC++のバイナリファイルを使って推論をしてみます

ダウンロードして解凍すると以下のような構造になっています

 piper-windows-x64/
  └── piper/
      ├── bin/
      │   ├── piper.exe
      │   ├── onnxruntime.dll
      │   ├── onnxruntime_providers_shared.dll
      │   ├── concrt140.dll
      │   ├── msvcp140.dll
      │   ├── msvcp140_1.dll
      │   ├── msvcp140_2.dll
      │   ├── msvcp140_atomic_wait.dll
      │   ├── msvcp140_codecvt_ids.dll
      │   ├── ucrtbase.dll
      │   ├── vcruntime140.dll
      │   ├── vcruntime140_1.dll
      │   └── api-ms-win-*.dll (多数のWindows API DLL)
      ├── lib/
      │   ()
      └── share/
          ├── open_jtalk/
          │   └── dic/
          │       ├── COPYING
          │       ├── char.bin
          │       ├── left-id.def
          │       ├── matrix.bin
          │       ├── pos-id.def
          │       ├── rewrite.def
          │       ├── right-id.def
          │       ├── sys.dic
          │       └── unk.dic
          └── piper/
              └── dicts/
                  ├── cmudict_data.json
                  ├── pinyin_phrases.json
                  └── pinyin_single.json

次にpiperフォルダで PowerShellを開きます

以下のコマンドを実行するとコマンドのヘルプが確認できます

.\bin\piper.exe --help

以下の出力がでます

options:
   -h        --help              show this message and exit
   -m  FILE  --model       FILE  path to onnx model file
   -c  FILE  --config      FILE  path to model config file (default: model path + .json, fallback: config.json in model dir)
   -t  TEXT  --text        TEXT  text to synthesize (no stdin required)
   -f  FILE  --output_file FILE  path to output WAV file ('-' for stdout)
   -d  DIR   --output_dir  DIR   path to output directory (default: cwd)
   --output_raw                  output raw audio to stdout as it becomes available
   -s  NUM   --speaker     NUM   id of speaker (default: 0)
   -l  CODE  --language    CODE  language code or id (default: auto)
   --noise_scale           NUM   generator noise (default: 0.667)
   --length_scale          NUM   phoneme length (default: 1.0)
   --noise_w               NUM   phoneme width noise (default: 0.8)
   --sentence_silence      NUM   seconds of silence after each sentence (default: 0.2)
   --phoneme_silence <phoneme> <seconds>  Set silence for a specific phoneme
   --custom-dict       FILE       path to custom dictionary file(s), comma-separated

   Phoneme input: Use [[ phonemes ]] notation to specify exact pronunciation
                  Example: echo "Hello [[ h ə l oʊ ]] world" | piper ...

   --json-input                  stdin input is lines of JSON instead of plain text
   --use-cuda                    use CUDA execution provider
   --gpu-device-id         NUM   GPU device ID for CUDA (default: 0)
   --raw-phonemes                interpret input as raw phonemes (space-separated)
   --streaming                   use streaming mode for reduced latency
   --output-timing         FILE  output phoneme timing to FILE
   --timing-format         FMT   timing output format: json|tsv (default: json)
   --list-models      [LANG]     list available voice models
   --download-model   NAME       download a voice model
   --model-dir        DIR        directory for downloaded models

   --debug                       print DEBUG messages to the console
   -q       --quiet              disable logging

environment variables:
   PIPER_DEFAULT_MODEL           default model path (if --model not specified)
   PIPER_DEFAULT_CONFIG          default config file path
   PIPER_MODEL_DIR               default model directory (if --model-dir not specified)
   PIPER_GPU_DEVICE_ID           GPU device ID for CUDA

モデルのダウンロード

次に公式が提供してるモデルを確認します

 .\bin\piper.exe --list-models

このコマンドを実行すると以下のように公式が提供しているCSS10(1)とつくよみちゃんモデル(2) があることがわかります

Available voice models:

  Japanese (日本語) [ja_JP]:
    ja_JP-css10-6lang-medium                [piper-plus]  1 speaker   medium   (css10, css10-6lang, css10-ja, ja-css10)
    ja_JP-tsukuyomi-chan-medium             [piper-plus]  1 speaker   medium   (tsukuyomi, tsukuyomi-chan, ja-tsukuyomi)

Use --download-model <name> to download a model.

今回はつくよみちゃんモデルを使うため、以下のコマンドでモデルのダウンロードを行います

.\bin\piper.exe --download-model tsukuyomi

実行すると以下のようにモデルのダウンロードが実行されます

[2026-03-22 19:32:39.945] [piper] [info] Downloading model: ja_JP-tsukuyomi-chan-medium (piper-plus)
[2026-03-22 19:32:39.947] [piper] [info]   config.json already exists, skipping
[2026-03-22 19:32:39.948] [piper] [info]   tsukuyomi-chan-6lang-fp16.onnx already exists, skipping

Model downloaded successfully!
Use with:  --model C:\Users\{username}\AppData\Roaming\piper\models\tsukuyomi-chan-6lang-fp16.onnx

(*1,2)

それぞれ以下のhuggingfaceで公開しています

huggingface.co

huggingface.co

推論

次に音声合成を実行します

コマンドは以下になります

\bin\piper.exe --model tsukuyomi --text "こんにちは、今日は良い天気ですね。"

--output_file output.wav をつけることでファイル名を指定できます