Files
Aletheia/tools/tts/README.md
T

36 lines
1.8 KiB
Markdown

# Aletheia Russian TTS corpus tools
`audit_corpus.py` verifies that an audiobook and EPUB contain the same text before any training data is produced.
It extracts the EPUB spine in reading order and compares local Whisper transcripts from the beginning, middle,
and end of the audiobook with the normalized book text.
Generated audio, transcripts, downloaded ASR models, and future training checkpoints belong under
`.codex-temp/tts-*`; they are working artifacts and must not be committed.
Example on Windows PowerShell:
```powershell
$env:PYTHONPATH = 'C:\Repos\Aletheia\.codex-temp\tts-python'
python tools\tts\audit_corpus.py `
--source-dir 'C:\path\to\audiobook' `
--output-dir '.codex-temp\tts-audit' `
--model base
```
The audit is not a copyright or voice-consent check. Training and distributing a voice model requires
separate confirmation that the recordings and narrator's voice may be used for that purpose.
After the audit passes, `transcribe_corpus.py` creates one resumable JSON sidecar per MP3 with segment and
word timestamps. Existing sidecars are skipped unless `--force` is supplied. These transcripts are alignment
anchors only; the final Piper labels must come from the exact EPUB text.
`build_piper_dataset.py` globally aligns all ASR tokens to the EPUB in monotonic reading order, rejects weak
matches, merges adjacent short segments, and writes 22.05 kHz mono PCM WAV files plus Piper's
`filename.wav|Exact book text` metadata. Use `--dry-run` first and inspect the reported exact-token match ratio
before producing WAV files.
`train_piper.sh` is the CUDA/Linux entry point for scratch training and ONNX export.
`train_piper_windows.ps1` provides the equivalent native Windows path and a `-SmokeTest` mode that executes one
training and validation batch on CUDA before a long run. See `GPU_TRAINING.md` for host prerequisites and the
acceptance gate.