tiny-urdu-tts: Small Urdu Text-to-Speech (TTS) Model 🇵🇰🎙️
tiny-urdu-tts is a small, open-source Urdu text-to-speech (TTS) model for Roman Urdu. It has only 4.5 million parameters (21 MB) and runs on a CPU or right in your web browser, with no GPU, server or API key.
اردو ٹیکسٹ ٹو اسپیچ: رومن اردو لکھیں اور سنیں
4.5M parameters · 21 MB · Urdu TTS · runs on CPU / in the browser
Type aap kaise hain? and it speaks it in Urdu.
Audio samples
| Text | Audio |
|---|---|
| aap kaise hain? | |
| mujhe chai pasand hai. | |
| shukriya, bohat shukriya! |
Model details
- Base model: tiny-voca by @n4ze3m, an English TTS model
- Fine-tuning: full fine-tune (all 4.5M parameters) on 5,000 clips (about 8 hours) from UrduTTS, for 25,000 steps on a Kaggle GPU
- Input: Roman Urdu text, converted to phonemes by a small rule-based phonemizer
- Output: 24 kHz mono audio
- Quality: word error rate (Whisper large-v3 on unseen sentences) 6.9%, down from 9.6% with 1,000 clips. Real recordings score 2.2%.
- Voice: one male Urdu voice (
M2)
Files
| File | Use |
|---|---|
model.onnx | Browser and CPU inference (onnxruntime / onnxruntime-web) |
model.json / config.json | Config: sample rate, voices, phoneme symbols |
sample1-3.wav | Audio samples |
inference.pt | PyTorch checkpoint, for further fine-tuning with tiny-voca |
How to use
The model takes phoneme IDs, not raw text. The Roman Urdu phonemizer is in the GitHub repo:
- Browser / JavaScript:
web/lib/urdu.tsandweb/app/page.tsx - Python:
python urdu/run.py tiny_voca.infer --checkpoint inference.pt --voice M2 --text "aap kaise hain?" --output out.wav
ONNX inputs: tokens, stress (int64 [1, N]), voice (int64 [1]), speed, pitch_shift, pitch_range (float32 [1]). Output: audio (float32 [1, samples]).
Writing tips
- Numbers work:
mere 25 dost hainis read as Urdu words - Common English words are said the Urdu way:
computer,mobile,doctor,hello,thanks - Write it the way you'd text:
mujhe chai pasand hai,shukriya, bohat shukriya! - A capital T, D, R inside a word marks the retroflex sound:
baRa(big) vsbura(bad)
Limitations
- Trained on about 8 hours from a single speaker, so expect some mispronunciations and a slightly robotic tone.
- English: only about 100 common loanwords are supported; other English words are read with Urdu spelling rules.
- Roman Urdu spelling varies, so some words may be read wrong.
- Urdu script (اردو) input is not supported yet.
Credits
- tiny-voca by @n4ze3m (Apache-2.0)
- UrduTTS dataset
- facebook/wav2vec2-lv-60-espeak-cv-ft, used for alignment