Skip to content

Coach’s voices

Coach speaks every card's revealed wording with a local Piper voice for that card's learning language: one English voice and one German voice. There is nothing to set up: start Coach with phrase-gym-coach (or uv run phrase-gym-coach in a source checkout).

What Coach sets up by itself

The first card that needs speech installs Piper's runtime, and the first card in each learning language downloads that language's voice. Coach prints one line while it does so, because that card takes longer:

Coach is installing its Piper speech runtime once; this card takes a few minutes.
Coach is downloading the German voice de_DE-thorsten-medium (63 MB) once; this card takes longer.

A language you never practise is never downloaded. Later cards reuse everything.

What macOS Linux
Voice file piper-voice.json ~/Library/Application Support/io.github.andgineer.Phrase-Gym-Coach/ ~/.local/share/io.github.andgineer.Phrase-Gym-Coach/
Piper runtime piper-1.8.0 (about 175 MB) the same folder as the voice file the same folder as the voice file
Voices (about 64 MB each) ~/Library/Caches/io.github.andgineer.Phrase-Gym-Coach/voices/ ~/.cache/io.github.andgineer.Phrase-Gym-Coach/voices/

Windows uses its standard per-user application data and cache folders.

The runtime is a private Python environment with the same Python minor version as Phrase Gym and exactly these packages, installed from binary wheels without dependency resolution and then checked with pip check: piper-tts==1.8.0, onnxruntime==1.31.0, flatbuffers==25.12.19, numpy==2.5.4, packaging==25.0, pathvalidate==3.3.1 and protobuf==7.36.2. Coach installs them only from PyPI, whatever index your pip settings name, and only wheels whose SHA-256 Coach already knows: the files PyPI publishes for Python 3.13 on Apple Silicon macOS 14 or later, x86_64 and arm64 Linux with glibc, and x86_64 Windows. onnxruntime 1.31.0 publishes no Python 3.13 wheel for Intel Macs or older macOS, so automatic setup fails there. Proxy settings in HTTPS_PROXY still apply. The runtime is built in a temporary folder and moved into place only when complete.

Voices come from Piper's voice collection at revision v1.0.0. Each file is downloaded to a temporary file, limited to its expected size and to ten minutes, and kept only when its SHA-256 matches:

Language File SHA-256
English en_US-ljspeech-medium.onnx 6f52a751e2349abe7a76735eb09dc1875298c77ea2342ffd2fef79ff81b87f22
English en_US-ljspeech-medium.onnx.json 141d612cc0a95ed7efc1ca936b845c2364967f2e9217c5dbfcf69fc4d6c65860
German de_DE-thorsten-medium.onnx 7e64762d8e5118bb578f2eea6207e1a35a8e0c30595010b666f983fc87bb7819
German de_DE-thorsten-medium.onnx.json 974adee790533adb273a1ac88f49027d2a1b8f0f2cf4905954a4791e79264e85

If the system clears the cache folder, or a cached voice no longer matches its SHA-256, Coach downloads that file again on its next card.

When something goes wrong

A failed download or installation is never used. Coach removes its temporary file or folder; only a forced stop can leave a hidden .download-… file or .piper-1.8.0-… folder behind, which you may delete. The card shows the reason in the Coach page with Retry, and the other language keeps working. A file with a different SHA-256 is deleted and reported.

Piper's pronunciation data must stay within a path of 159 bytes. With an unusually long home folder Coach reports that the runtime folder is too long; use a manual setup in a shorter folder as described below.

Coach never replaces a voice file you already have. A voice file that lacks a learning language gets that language's pinned voice added and keeps everything else. A voice file Coach cannot read is reported in the Coach page and left untouched: correct it, or move it away so Coach creates a new one. A voice file written for an earlier Coach that names a single English voice at its top level is reported as the old single-voice format: keep executable and runtime_version where they are and move the other fields under voices.en.

Manual setup

To use your own Piper environment, other voices or another location, set PHRASE_GYM_PIPER_CONFIG to the absolute path of a voice file with one entry per learning language:

{
  "executable": "/absolute/path/to/piper/bin/python",
  "runtime_version": "1.8.0",
  "voices": {
    "en": {
      "model": "/absolute/path/to/en_US-ljspeech-medium.onnx",
      "model_sha256": "6f52a751e2349abe7a76735eb09dc1875298c77ea2342ffd2fef79ff81b87f22",
      "config": "/absolute/path/to/en_US-ljspeech-medium.onnx.json",
      "config_sha256": "141d612cc0a95ed7efc1ca936b845c2364967f2e9217c5dbfcf69fc4d6c65860",
      "voice": "en_US-ljspeech-medium",
      "locale": "en-US"
    },
    "de": {
      "model": "/absolute/path/to/de_DE-thorsten-medium.onnx",
      "model_sha256": "7e64762d8e5118bb578f2eea6207e1a35a8e0c30595010b666f983fc87bb7819",
      "config": "/absolute/path/to/de_DE-thorsten-medium.onnx.json",
      "config_sha256": "974adee790533adb273a1ac88f49027d2a1b8f0f2cf4905954a4791e79264e85",
      "voice": "de_DE-thorsten-medium",
      "locale": "de-DE"
    }
  }
}

The runtime is any Python environment with the packages listed above, for example:

PIPER=/absolute/path/to/piper
python3.13 -m venv "$PIPER"
"$PIPER/bin/python" -I -m pip install --no-deps --only-binary=:all: \
  piper-tts==1.8.0 onnxruntime==1.31.0 flatbuffers==25.12.19 numpy==2.5.4 \
  packaging==25.0 pathvalidate==3.3.1 protobuf==7.36.2
"$PIPER/bin/python" -I -m pip check

Coach still adds a missing English or German voice to that file, using the voice cache above.

What Coach checks on every card

Coach verifies the exact installed piper-tts version against runtime_version, each voice's model/config hashes, and that the voice's locale matches its learning language: en-US for English and de-DE for German. Coach streams the selected interpreter's output under hard 8 MiB audio, 64 KiB diagnostic, and 60-second limits, terminates a process that exceeds a bound, and sends WAV references to the Phrase Gym API for atomic publication. Automated tests use a silent fake child and never invoke real Piper, download voices or install packages.