TinyVoca-Vi (v0.2.2)
Ultra-lightweight (4.77M parameters, 12.39 MB Brotli, 3 Northern Vietnamese female voices in ONE ONNX file, 24 kHz mono) Text-to-Speech model designed to run 100% client-side in the browser via single-thread ONNX Runtime Web (WASM SIMD)—no backend, no Python at runtime, works offline after first load.
- Try Live in Browser (HF Space, 100% Client-Side WASM): huggingface.co/spaces/datmt24/tiny-voca-vi
- Try Live in Browser (GitHub Pages): datmt.github.io/tiny-voca-vi
- Code, G2P & training scripts: github.com/datmt/tiny-voca-vi
- Voices (3 Northern miền Bắc female voices in v0.2):
voice_id = 1— Quỳnh Anh (recommended default): Storytelling timbre, clearest tones (0.09%CER)voice_id = 2— Trúc Ly: Youngest, brisk & expressive timbrevoice_id = 0— Mai Anh: Crisp news-anchor timbre
- Front-end:
~15 KBgzipped deterministic rule-based Northern Vietnamese G2P (web/g2p.js/src/tiny_voca_vi/g2p.py) plus an English word list (web/en_lexicon.js, ~250 KB gzipped, derived from CMUdict).
What's New in v0.2.2
- Foreign words are read as English, with stress and rhythm: about 39,000 English words and names are respelled from CMUdict (lake → "lếch", update → "ấp đết"). Other words keep the letter rules; main stress is guessed with the Latin rule (Palsada → pan-sa-đa).
- New
stressinput in the ONNX graph: per-token duration, pitch and energy offsets. No retraining: the weights are those of v0.2.1 and Vietnamese text without foreign words gives identical audio (max difference 0 on 60 sentences, 3 voices). Breaking for direct ONNX users:stressis required; pass(1, 0, 0)for every token to get the v0.2.1 behaviour. - Uneven rhythm: middle syllables of a foreign word are compressed, so syllables no longer arrive on an even beat. On 400 held-out words in a Vietnamese carrier sentence,
whisper-large-v3-turbowrites the English word for 145–148 with stress against 113–131 without (per voice). On a separate set of 300 words, Quỳnh Anh, the new readings alone went from 49 to 82. - Known limits: consonant clusters (cl-, st-) are still rarely recognised, because the model was trained on Vietnamese only; names outside the dictionary are read by letter rules.
What's New in v0.2.1
- Pauses in the right places: punctuation inside a sentence now gets a minimum pause in the ONNX graph (comma 160 ms, inner full stop 300 ms, scaled by
pauseandspeed). In v0.2 Quỳnh Anh skipped about half of all commas. Brackets, spaced dashes, line breaks,...,v.v., initials and number ranges are handled in the text front-end, and the demo adds a gap between sentences. - Clear p sounds (Sa Pa, Paris, pound): fine-tuned on 0.8 h of p-rich speech (v0.2's Quỳnh Anh data had 6 p onsets). A phoneme recognizer hears p as p on held-out sentences: Quỳnh Anh 28% → 85%, Mai Anh 41% → 81%, Trúc Ly 61% → 87%.
- Reads abbreviations, currencies, units, English and foreign words:
4.000 USD/ounce,UBND TP.HCM,10h30, Opasada, and the look-alikeÐ. - Tones, stated plainly: on the 48-word test Quỳnh Anh scores 79.2% (v0.2: 87.5%), Trúc Ly 91.7% (85.4%), Mai Anh 75.0% (77.1%). On a wider test (same 48 words, 3 carrier sentences, 2 recognizers) they score 86.6% / 84.0% / 79.5% against 84.2% / 83.0% / 81.9%, so we see no clear change overall.
- Known limits: long sentences without punctuation get no breath; Trúc Ly has a 7–8% word error rate on the general sentences in both versions.
What's New in v0.2
- Voicing-Gated Pitch-Locked
HN-Vocos: Eliminates the subtle hall/room echo from v0.1's unconstrained-phase Vocos head while keeping zero static onr/s/xfricatives. - 3 Voices in 1 Model (
+1.5 KBoverhead): Switch voices instantaneously viavoice_id: int64[1]without reloading the ONNX session. - Zero-DC / Zero-Nyquist Spectral Mask: Eliminates end-of-clip clicks/pops (
mean(DC) = 0.000000, trailing silence peak0.00001).
Files Included
| File | Voices | Params | Raw / Brotli | Native 1T RTF | Minimal-Pair Tone Acc | Notes |
|---|---|---|---|---|---|---|
onnx/tiny-voca-vi-v0.2.2-hnvocos-fp16.onnx |
3 | 4.77M | 14.33 MB / 12.39 MB |
0.0123 (~80× RT) |
as v0.2.1 (same weights) | Recommended · foreign words with stress, stress input |
onnx/tiny-voca-vi-v0.2.1-hnvocos-fp16.onnx |
3 | 4.77M | 14.32 MB / 12.39 MB |
0.0125 (~80× RT) |
79.2% (Quỳnh Anh) · 91.7% (Trúc Ly) · 75.0% (Mai Anh); wider test 86.6 / 84.0 / 79.5% | minimum pauses, clear p, 0.09% CER (Quỳnh Anh) |
checkpoints/tiny-voca-vi-v0.2.1-hnvocos.pt |
3 | 4.77M | PyTorch weights + config | — | — | v0.2 fine-tuned 8k steps (also the weights of v0.2.2) |
onnx/tiny-voca-vi-v0.2-hnvocos-fp16.onnx |
3 | 4.77M | 14.32 MB / 12.37 MB |
0.0125 (~80× RT) |
87.5% (Quỳnh Anh) · 85.4% (Trúc Ly) · 77.1% (Mai Anh) | v0.2 · echo-free HN-Vocos, 0.16% CER (Quỳnh Anh) |
checkpoints/tiny-voca-vi-v0.2-hnvocos-26k.pt |
3 | 4.77M | PyTorch weights + config | — | — | Trained 26k steps on 12.11 h clean data |
onnx/tiny-voca-vi-v0.1-1024-fp16.onnx |
1 | 4.66M | 13.84 MB / 9.99 MB |
0.0098 (~102× RT) |
79.2% (Mai Anh) |
Legacy v0.1 (Vocos-1M, 0.00% CER) |
onnx/tiny-voca-vi-v0.1-512-fp16.onnx |
1 | 4.55M | 10.46 MB / 8.74 MB |
0.0086 (~116× RT) |
70.8% (Mai Anh) |
Legacy v0.1 (2× overlap) |
checkpoints/tiny-voca-vi-v0.1-1024.pt |
1 | 4.66M | PyTorch weights + config | — | — | Legacy v0.1 |
checkpoints/tiny-voca-vi-v0.1-512.pt |
1 | 4.55M | PyTorch weights + config | — | — | Legacy v0.1 |
(All ONNX files store large Linear/Conv weights and fixed STFT kernels in FP16 with Cast(FP16→FP32) compute—zero DFT ops, bit-exact determinism.)
Audio Samples (24 kHz, Free-Running E2E — v0.2)
Voice (voice_id) |
Sentence | Sample (v0.2-hnvocos) |
|---|---|---|
Quỳnh Anh (1) |
Mỗi ngày em đều dậy sớm chạy bộ quanh hồ Hoàn Kiếm khoảng ba mươi phút. | |
Trúc Ly (2) |
Mỗi ngày em đều dậy sớm chạy bộ quanh hồ Hoàn Kiếm khoảng ba mươi phút. | |
Mai Anh (0) |
Mỗi ngày em đều dậy sớm chạy bộ quanh hồ Hoàn Kiếm khoảng ba mươi phút. | |
Quỳnh Anh (1) |
Hôm nay thời tiết Hà Nội mát mẻ, nắng nhẹ và không có mưa. | |
Trúc Ly (2) |
Hôm nay thời tiết Hà Nội mát mẻ, nắng nhẹ và không có mưa. | |
Quỳnh Anh (1) |
Tiếng Việt có sáu thanh điệu rất rõ ràng, đặc biệt là thanh ngã và thanh nặng. |
ONNX Interface (v0.2 to v0.2.2)
Inputs:
phoneme_ids:int64[1, T]tone_ids:int64[1, T](0=silence/punct,1..6=ngang, huyền, sắc, hỏi, ngã, nặng)syl_pos:int64[1, T](0=onset,1=medial/nucleus,2=coda,3=non-syllabic)voice_id:int64[1](0=Mai Anh,1=Quỳnh Anh,2=Trúc Ly)speed:float32[1](0.7–1.5)pitch_shift:float32[1](-4.0to+4.0semitones)pause:float32[1](0.5–2.0, scalestone_id == 0durations and, from v0.2.1 on, the minimum pauses)stress(v0.2.2 only, required):float32[1, T, 3]= duration factor, pitch offset in semitones, energy offset per token; neutral is(1, 0, 0). Built bystress_features()/stressFeatures().
Outputs:
audio:float32[1, N * 256](24 kHz mono PCM)durations:int64[1, T](frames per token)
License & Attribution
Apache-2.0. Architecture and export conventions adapted from n4ze3m/tiny-voca (Apache-2.0); training audio distilled from pnnbao-ump/VieNeu-TTS-v3-Turbo (Apache-2.0, presets Mai Anh, Quỳnh Anh, Trúc Ly) over wikimedia/wikipedia 20231101.vi (CC BY-SA 4.0); English readings derived from CMUdict (BSD-style); offline CTC alignment with facebook/wav2vec2-lv-60-espeak-cv-ft (Apache-2.0); filtering & eval with vinai/PhoWhisper-medium (BSD-3-Clause).