n4ze3m/tiny-voca
A 4.5M-parameter two-voice English text-to-speech model, trained from scratch
What it is
tiny-voca is a small English text-to-speech model. It turns written text into spoken audio, with two fixed voices, and is small enough to run on a CPU or in a web browser.
Key facts
- Size: 4,537,291 parameters, about 18 MB, including the waveform generator.
- Speed: Roughly 70x real time on four CPU threads (it generates audio faster than the audio's own duration).
- Voices: Two — F2 (female) and M2 (male), both American English at 24 kHz.
- Runs on: PyTorch, ONNX Runtime, and ONNX Runtime Web (browser).
- Open: Code, weights, training recipe, and dataset are all public. The model was trained from scratch.
How to use it
Install, download the weights, then run a command like:
python -m tiny_voca.infer --checkpoint weights/tiny-voca.pt --voice F2 --text "Hello! This is tiny voca." --output hello.wav
Adjustable options include:
--voice: F2 or M2--speed: speaking rate (default 1.0)--pitch-shift: raise or lower pitch (default 0)--pitch-range: more or less pitch movement (default 1.0)--text-file: read text from a file instead of--text
Long text is handled sentence by sentence, and the audio clips are joined. If the text doesn't end with punctuation, a full stop is added so the last word doesn't cut off. Sentences with nothing to read (e.g., in another script) are skipped. Output never peaks above 0.99, so it won't clip as a 16-bit WAV. The same functionality is available in Python via tiny_voca.infer.speak_text.
Browser demo
The demo runs the model entirely in the browser. It plays each sentence as soon as it's generated and keeps the full clip in the player. The source lives in the web/ directory.
Training
The training pipeline involves preparing data, annotating features, training, and evaluating. The released weights took 7.7 hours on a single RTX 4090 GPU. More details are in docs/model.md.
Known limits
- English only, two fixed voices, no voice cloning.
- The F2 voice sounds younger than intended; a more mature voice is planned.
- Foreign names and unusual spellings are often read incorrectly.
- No streaming support yet.
Cost
The entire project — dataset, failed attempts, and final training run — cost $9.56 of GPU time on one rented RTX 4090.
License
- Code and weights: Apache-2.0
- Dataset: CC BY 4.0
Related
- Project
- Project
- Project
- Project