How ohf-voice/piper1-gpl works
Piper is a local neural text-to-speech engine with Python and C/C++ interfaces, a command-line tool, an optional HTTP server, and voice-training support. Its main workflow accepts text, converts it to phonemes and IDs, runs a voice model, and returns or writes audio. The graph also preserves multilingual phonemization, voice acquisition, and training/export capabilities documented by the README. Some subsystems are represented from the file tree and README because their implementation was not sampled; their internal wiring is intentionally limited.
Main entry points: voice.py Python voice runtime · main.cpp C++ CLI · piper.cpp Native synthesis · phonemize_espeak.py Language phonemizers
Components 23
User interfaces
- Python CLI
src/piper/__main__.py - HTTP server
src/piper/http_server.py - Python API
src/piper/__init__.py - C++ CLI
libpiper/src/main/main.cpp - C/C++ API
libpiper/include/piper.h - Voice download
src/piper/download_voices.py
Text processing
- Language phonemizers
src/piper/phonemize_espeak.py - Chinese G2P
src/piper/phonemize_chinese.py - G2PW inference
src/piper/g2pw_onnx.py - Hebrew IPA
src/piper/hebrew/hebrew_ipa.py - Phoneme IDs
src/piper/phoneme_ids.py
Speech runtime
- Python voice runtime
src/piper/voice.py - Voice configuration
src/piper/config.py - ONNX voice model
- Audio playback
src/piper/audio_playback.py - Native synthesis
libpiper/src/piper.cpp - WAV output
libpiper/src/main/utils/wavfile.cpp
Voice training
- Training dataset
src/piper/train/vits/dataset.py - VITS training model
src/piper/train/vits/models.py - Checkpoint inference
src/piper/train/infer_torch.py - ONNX export
src/piper/train/export_onnx.py
Other components
- Text consumer
- Speech audio
Connections 24
- Text consumer → Python CLI: provides text
- Text consumer → HTTP server: sends request
- Text consumer → Python API: provides text
- Text consumer → C++ CLI: provides text
- Python CLI → Python voice runtime: synthesizes with
- HTTP server → Python voice runtime: serves via
- Python API → Python voice runtime: uses
- C++ CLI → Native synthesis: creates and invokes
- Native synthesis → Language phonemizers: phonemizes with
- Native synthesis → ONNX voice model: runs model
- C++ CLI → WAV output: writes audio
- Python voice runtime → Voice configuration: loads
- Python voice runtime → Language phonemizers: phonemizes with
- Python voice runtime → Phoneme IDs: encodes as
- Python voice runtime → ONNX voice model: runs inference
- Python voice runtime → Speech audio: returns audio
- Python voice runtime → Audio playback: plays through
- Chinese G2P → G2PW inference: uses inference
- Language phonemizers → Hebrew IPA: supports Hebrew
- Voice download → Text consumer: provides voices
- Training dataset → VITS training model: supplies batches
- VITS training model → Checkpoint inference: produces checkpoint
- Checkpoint inference → ONNX export: exports model
- ONNX export → ONNX voice model: creates voice model