tiny-voca-si: Sinhala text-to-speech (සිංහල)
A small Sinhala text-to-speech model: 4.5M parameters, about 20 MB, two voices, 24 kHz, and it runs on an ordinary CPU (PyTorch or ONNX Runtime). It is a Sinhala version of tiny-voca, trained from scratch on about 18 hours of Sinhala speech.
▶ Try it in your browser: https://huggingface.co/spaces/eminduperera/tiny-voca-sinhala (runs on your device, no install)
Code, Kaggle notebooks and training scripts: https://github.com/Emindu/tiny-voca-sinhala
| Voice | Speaker | Training audio |
|---|---|---|
M1 |
Ven. Mettananda (male) | about 10.3 h |
F1 |
Mrs. Oshadi (female) | about 7.9 h |
Update (v2, step 55,000): the first upload (step 39,425) sometimes made
M1speak at a female pitch. The cause was in the data: the dataset's first release is read by Mrs. Oshadi, but it had been labelled as the male voice. v2 relabels those 3,000 clips and fine-tunes the model on the corrected labels.M1now stays at about 105–125 Hz andF1at about 210–250 Hz on every test sentence.
Samples
| M1 | F1 | |
|---|---|---|
| ආයුබෝවන්! ඔබට කොහොමද? | ||
| අද කාලගුණය හොඳයි, ඒත් හවසට වැසි ඇති විය හැකියි. | ||
| ශ්රී ලංකාව ඉන්දියන් සාගරයේ පිහිටි සුන්දර දිවයිනකි. | ||
| මම හෙට උදේ කොළඹට යනවා. |
Quick start (ONNX, no tiny-voca install needed)
git clone https://huggingface.co/eminduperera/tiny-voca-sinhala
cd tiny-voca-sinhala
pip install -r requirements.txt
python speak.py "ආයුබෝවන්! ඔබට කොහොමද?" --voice M1 --output hello.wav
On Windows, set PYTHONUTF8=1 if the console garbles Sinhala, or use --text-file input.txt
with a UTF-8 file.
From Python:
from speak import SinhalaTTS
tts = SinhalaTTS() # loads tiny-voca-si.onnx
audio = tts.speak("ශ්රී ලංකාව සුන්දර රටකි.", voice="M1", speed=1.0)
tts.save(audio, "out.wav") # float32, 24 kHz mono
Options: speed (larger is faster), pitch_shift (0.058 ≈ one semitone), pitch_range
(more or less intonation). Text of any length is read sentence by sentence.
Files
| File | |
|---|---|
tiny-voca-si.onnx + tiny-voca-si.json |
ONNX model and its metadata (voices, symbols, front-end fingerprint) |
tiny-voca-si.pt |
PyTorch checkpoint for the tiny-voca code with sinhala.patch applied |
speak.py, frontend.py, sinhala.py |
Standalone text front end + ONNX runner |
sinhala.patch |
Adds Sinhala to tiny-voca at commit 70759ac (for PyTorch inference or training) |
samples/ |
The audio above |
PyTorch (with the tiny-voca code)
git -c core.autocrlf=false clone https://github.com/n4ze3m/tiny-voca && cd tiny-voca
git checkout 70759ac61104d021c7f498e32c12f4979511bfa4
git apply ../tiny-voca-sinhala/sinhala.patch
pip install -e ".[si]"
TINY_VOCA_LANGUAGE=si python -m tiny_voca.infer --checkpoint ../tiny-voca-sinhala/tiny-voca-si.pt \
--voice M1 --text "ආයුබෝවන්!" --output hello.wav
How it works
Sinhala text → phonemes → model → waveform.
- Front end. eSpeak NG's Sinhala voice (
si, the library from the pinnedespeakng-loaderwheel), with corrections: zero-width joiners are removed (ශ්රී and ක්ර stay one word), ශ is read asʃ, and the prenasalized stops ඹ ඳ ඟ become single phonemes (ᵐb,ⁿd,ᵑɡ). The inventory has 73 symbols. Every one of the 9,686 training sentences phonemizes with no unknown phoneme. - Model. The unchanged tiny-voca architecture: a 4-block transformer text encoder, explicit duration/pitch/energy prediction, and a source-filter waveform head instead of a neural vocoder.
Training
- Data: the Path Nirvana Sinhala TTS dataset (v2.1 release plus the first release), resampled to 24 kHz with edge silence trimmed. That is 9,686 clips of 1–15 s, split by sentence into train, validation and test.
- Alignment: phoneme durations from forced alignment with
facebook/wav2vec2-lv-60-espeak-cv-ft(annotation only). The aligner was not trained on Sinhala, so the quality gates were set from the Sinhala data's own distribution (mean token probability ≥ 0.33, weak-phone share ≤ 0.5). This kept 94% of clips: 8,632 train clips (18.3 h), 189 validation, 161 test. - Recipe: tiny-voca's default: spectral losses only for the first 8,000 steps, then adversarial losses as well, on one NVIDIA T4 (free Kaggle GPU). 39,425 steps from scratch (about 10.7 h), then 15,575 steps of fine-tuning with the corrected voice labels (about 5.2 h), for 55,000 steps in total.
- Voice check: after training, the notebook synthesizes 12 test sentences in each voice and checks the median pitch (M1 106–123 Hz, F1 209–252 Hz on this model).
There is no formal evaluation (no Sinhala ASR word error rate yet). Judge by listening.
Limitations
- Pronunciation follows eSpeak NG's Sinhala rules. It does not distinguish ඬ from ණ්ඩ, reads digits word by word, and some Pali/Sanskrit words, abbreviations and Latin-script words come out approximately.
- The training text is largely Buddhist and educational prose, so everyday conversational prosody is less natural.
- Two fixed voices; there is no voice cloning.
Licence and use
- Model weights: GPL-3.0, following the training data. The speakers donated their voices for non-obscene, non-offensive speech generation only. Do not use this model to impersonate them, or for deceptive, obscene or offensive content.
- Training data: Path Nirvana Sinhala TTS dataset, © Path Nirvana Foundation, GPL-3.0.
- Code: tiny-voca is Apache-2.0.
sinhala.py,frontend.pyandspeak.pyfollow it. - eSpeak NG (used at run time through
espeakng-loader) is GPL-3.0.
Credits
- tiny-voca by Muhammed Nazeem: https://github.com/n4ze3m/tiny-voca
- Sinhala port: https://github.com/Emindu/tiny-voca-sinhala
- Voices: Ven. Mettananda and Mrs. Oshadi, through the Path Nirvana Foundation
- eSpeak NG, phonemizer and the wav2vec2 phoneme aligner (annotation only)
@software{nazeem2026tinyvoca,
author = {Nazeem, Muhammed},
title = {tiny-voca: a 4.5M-parameter two-voice English text-to-speech model},
year = {2026},
url = {https://huggingface.co/n4ze3m/tiny-voca}
}