File size: 17,417 Bytes
8117eff | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | ---
license: cc-by-nc-4.0
language:
- ar
- en
tags:
- text-to-speech
- tts
- vits
- bigvgan
- levantine-arabic
- arabic
- code-switching
- streaming
- low-latency
- real-time
- dialectal-arabic
base_model: facebook/mms-tts-ara
pipeline_tag: text-to-speech
library_name: pytorch
---
# Shami-TTS โ Production-Grade Levantine Arabic โ English Code-Switching TTS
> A low-latency, **streaming** text-to-speech system that speaks natural, **Levantine
> Arabic** and switches to **English** mid-utterance without a prosodic seam. v2 turns the
> promising-but-robotic v1 baseline into a **production-grade** voice on a **single consumer
> GPU (RTX 3060, 12 GB)**: **Levantine CER 0.75 โ 0.11 (โ86%), WER 0.99 โ 0.35**, natural
> prosody, 24 kHz fidelity, and reference-level texture โ at **~11ร faster than real-time**.
This card documents v2 **exhaustively** โ what changed from v1, the architecture, the two
vocoder options we release, measured results, usage for both, the training recipe, an honest
engineering log, and licensing. A full **9-page technical report** is included at
[`paper/shami_tts.pdf`](paper/shami_tts.pdf).
---
## 0. TL;DR
| Held-out metric (ASR round-trip, Whisper large-v3, โ better) | Baseline (v1) | **v2 HiFi-GAN** | **v2 + BigVGAN** |
|---|---|---|---|
| **Levantine Arabic CER** | 0.751 | 0.113 | **0.106** |
| **Levantine Arabic WER** | 0.993 | 0.377 | **0.347** |
| Code-switch CER | 0.853 | **0.498** | 0.556 |
| Overall CER | 0.802 | **0.305** | 0.331 |
| Real-time factor (RTX 3060) | 0.024 | 0.028 | ~0.085 |
| Duration ratio @ `length_scale=1` | 0.31 (needs 3.2ร stretch) | **0.97** | **0.97** |
- **Two vocoders released.** The **HiFi-GAN** decoder is a single self-contained VITS model
(minimal deps). **BigVGAN** re-vocodes for the cleanest texture (removes the residual
high-frequency breathiness). Pick per your fidelity/latency/dependency budget.
- **Single flagship speaker** ("Badr") in this release; multi-speaker is v3.
- **Infer at `length_scale = 1.0`** (deterministic duration โ do *not* use 3โ5 as in v1).
---
## ๐ Listen
Synthesized at `length_scale=1.0`. **Reference** = real recording; **HiFi-GAN** = self-contained decoder; **BigVGAN** = highest-fidelity vocoder. Players stream on demand.
### Pure Levantine
ุถูุช ูุงููุฉ ุณุงูุชุฉ ุจุฏูู ู
ุง ุชุญูู ุจูุณู ูุงูุช ุชุชูุฑุฌ ุนูู ูุงูุง ููุช ุฑุงูุจ ุงูู
ู ููู ุนู
ุชูุฒู ูุณุฑุญุงูุฉ.
| Reference | HiFi-GAN | BigVGAN |
|---|---|---|
| <audio controls preload="none" src="https://huggingface.co/Tushe/shami-tts/resolve/main/samples/lev_01_reference.wav"></audio> | <audio controls preload="none" src="https://huggingface.co/Tushe/shami-tts/resolve/main/samples/lev_01_hifigan.wav"></audio> | <audio controls preload="none" src="https://huggingface.co/Tushe/shami-tts/resolve/main/samples/lev_01_bigvgan.wav"></audio> |
ุญุณูุช ูููู ููุฌูุน ู ุงููุณุงุฑ ูุฌุนู ู
ุชู ูุฌุนู ุงูุชููู ู
ุธููู
ูู ู ุจุฏูู ุญููุฉ.
| Reference | HiFi-GAN | BigVGAN |
|---|---|---|
| <audio controls preload="none" src="https://huggingface.co/Tushe/shami-tts/resolve/main/samples/lev_02_reference.wav"></audio> | <audio controls preload="none" src="https://huggingface.co/Tushe/shami-tts/resolve/main/samples/lev_02_hifigan.wav"></audio> | <audio controls preload="none" src="https://huggingface.co/Tushe/shami-tts/resolve/main/samples/lev_02_bigvgan.wav"></audio> |
ู
ุง ููู ุชุนู
ู ุดูุบูู ู
ุฑุชุจ ุจูุจูุงู ุงูุง ุงุฐุง ูุงู ุนูุฏู ุธูุฑ ู
ุงูู.
| Reference | HiFi-GAN | BigVGAN |
|---|---|---|
| <audio controls preload="none" src="https://huggingface.co/Tushe/shami-tts/resolve/main/samples/lev_03_reference.wav"></audio> | <audio controls preload="none" src="https://huggingface.co/Tushe/shami-tts/resolve/main/samples/lev_03_hifigan.wav"></audio> | <audio controls preload="none" src="https://huggingface.co/Tushe/shami-tts/resolve/main/samples/lev_03_bigvgan.wav"></audio> |
### Code-switching
ููุด ุงูtraining ู
ูุดู ุดุบูุงู on the serverุ.
| Reference | HiFi-GAN | BigVGAN |
|---|---|---|
| <audio controls preload="none" src="https://huggingface.co/Tushe/shami-tts/resolve/main/samples/cs_01_reference.wav"></audio> | <audio controls preload="none" src="https://huggingface.co/Tushe/shami-tts/resolve/main/samples/cs_01_hifigan.wav"></audio> | <audio controls preload="none" src="https://huggingface.co/Tushe/shami-tts/resolve/main/samples/cs_01_bigvgan.wav"></audio> |
ูู ู
ุดููุฉ ุจ the errorุ ูุงุฒู
ูุตููุญูุง.
| Reference | HiFi-GAN | BigVGAN |
|---|---|---|
| <audio controls preload="none" src="https://huggingface.co/Tushe/shami-tts/resolve/main/samples/cs_02_reference.wav"></audio> | <audio controls preload="none" src="https://huggingface.co/Tushe/shami-tts/resolve/main/samples/cs_02_hifigan.wav"></audio> | <audio controls preload="none" src="https://huggingface.co/Tushe/shami-tts/resolve/main/samples/cs_02_bigvgan.wav"></audio> |
ุญููุชูู ุนู the project ูุจูุ ูู light.
| Reference | HiFi-GAN | BigVGAN |
|---|---|---|
| <audio controls preload="none" src="https://huggingface.co/Tushe/shami-tts/resolve/main/samples/cs_03_reference.wav"></audio> | <audio controls preload="none" src="https://huggingface.co/Tushe/shami-tts/resolve/main/samples/cs_03_hifigan.wav"></audio> | <audio controls preload="none" src="https://huggingface.co/Tushe/shami-tts/resolve/main/samples/cs_03_bigvgan.wav"></audio> |
### Showcase โ novel unseen text
**Long, natural Levantine** โ ุจูุนุฑูู ุฅููู ุงูููููุช ุชุฃุฎูุฑ ููุชูุฑุ ุจูุณ ุตูุฏูููู ู
ุง ููุตูุฑูุชุ ุถูููุช ุนูู
ุญุงููู ุทูู ุงููููุงุฑ ููุญุชูู ุฎููุตูุช ููู ุงูุดูุบูู.
| HiFi-GAN | BigVGAN (recommended) |
|---|---|
| <audio controls preload="none" src="https://huggingface.co/Tushe/shami-tts/resolve/main/samples/show_01_hifigan.wav"></audio> | <audio controls preload="none" src="https://huggingface.co/Tushe/shami-tts/resolve/main/samples/show_01_bigvgan.wav"></audio> |
**Heavy code-switch (AR + EN)** โ ุงูู meeting ุจููุฑุง ุงูุณุงุนุฉ ุชุณุนุฉุ ูุจูุฏูู ูุฑุงุฌูุน ุงูู dashboard ูุงูู analytics ููุจูู ู
ุง ูุนู
ูู ุงูู presentation.
| HiFi-GAN | BigVGAN (recommended) |
|---|---|
| <audio controls preload="none" src="https://huggingface.co/Tushe/shami-tts/resolve/main/samples/show_02_hifigan.wav"></audio> | <audio controls preload="none" src="https://huggingface.co/Tushe/shami-tts/resolve/main/samples/show_02_bigvgan.wav"></audio> |
**Numbers, currency, date** โ ุฏููุนูุช ู
ูุฉ ูุฎู
ุณุฉ ูุนุดุฑูู ุฏููุงุฑ ุนู ุงูุฃูุชููุ ูุงูุฑููุญูุฉ ุจุชูููู ุชูุงุชุฉ ุขูุงู ูุฎู
ุณู
ูุฉ ููุฑุฉุ ูุงูู
ูุนุฏ ููู
ุงุชููู.
| HiFi-GAN | BigVGAN (recommended) |
|---|---|
| <audio controls preload="none" src="https://huggingface.co/Tushe/shami-tts/resolve/main/samples/show_03_hifigan.wav"></audio> | <audio controls preload="none" src="https://huggingface.co/Tushe/shami-tts/resolve/main/samples/show_03_bigvgan.wav"></audio> |
**Question + exclamation** โ ุดู ุตุงุฑ ู
ูุนููุ! ููุด ู
ูุชุถุงููู ูููููุฏุ ููููุง ุงุญูููู ููู ุดู ุจุงูุชููุตููุ ูุง ุชูุฎุจูู ุนูููู ูููุง ูููู
ุฉ!
| HiFi-GAN | BigVGAN (recommended) |
|---|---|
| <audio controls preload="none" src="https://huggingface.co/Tushe/shami-tts/resolve/main/samples/show_04_hifigan.wav"></audio> | <audio controls preload="none" src="https://huggingface.co/Tushe/shami-tts/resolve/main/samples/show_04_bigvgan.wav"></audio> |
**Tech / brand names** โ ูุฒูููุช ุขุฎูุฑ version ู
ูู ุงูู app ุจูุณ ุงูู update ููุณูุฑ ุงูู loginุ ูุจุนุชูุชูููู ticket ุนู ุงูู support.
| HiFi-GAN | BigVGAN (recommended) |
|---|---|
| <audio controls preload="none" src="https://huggingface.co/Tushe/shami-tts/resolve/main/samples/show_05_hifigan.wav"></audio> | <audio controls preload="none" src="https://huggingface.co/Tushe/shami-tts/resolve/main/samples/show_05_bigvgan.wav"></audio> |
**English-heavy technical** โ The neural vocoder reduces spectral artifacts, ุจูุณ ูุงุฒูู
ูู fine-tune ุงูู model ุนู ุจูุงูุงุช ุฃูุถูู.
| HiFi-GAN | BigVGAN (recommended) |
|---|---|
| <audio controls preload="none" src="https://huggingface.co/Tushe/shami-tts/resolve/main/samples/show_06_hifigan.wav"></audio> | <audio controls preload="none" src="https://huggingface.co/Tushe/shami-tts/resolve/main/samples/show_06_bigvgan.wav"></audio> |
**Warm greeting (assistant)** โ ู
ูุฑุญูุจุง ููู! ุฃูุง ู
ุณุงุนูุฏูู ุงูุตูุชูุ ููู ุจููุฏูุฑ ุณุงุนุฏูู ุงูููู
ุ just tell me what you need.
| HiFi-GAN | BigVGAN (recommended) |
|---|---|
| <audio controls preload="none" src="https://huggingface.co/Tushe/shami-tts/resolve/main/samples/show_07_hifigan.wav"></audio> | <audio controls preload="none" src="https://huggingface.co/Tushe/shami-tts/resolve/main/samples/show_07_bigvgan.wav"></audio> |
**Emphatics + gutturals** โ ุงูุทูุจูุจ ูุงู ุฅููู ุงูุตูุญูุฉ ุจุฎูุฑุ ูุงูุถูุบูุท ุทุจูุนูุ ูุงูููููุจ ุนูู
ููุดุชูุบูู ู
ูููุญุ ุงูุญูู
ุฏู ููู ุนู ููู ุดู.
| HiFi-GAN | BigVGAN (recommended) |
|---|---|
| <audio controls preload="none" src="https://huggingface.co/Tushe/shami-tts/resolve/main/samples/show_08_hifigan.wav"></audio> | <audio controls preload="none" src="https://huggingface.co/Tushe/shami-tts/resolve/main/samples/show_08_bigvgan.wav"></audio> |
---
## 1. What's new in v2 (vs. the published baseline)
v2 is four targeted contributions, each measured (see the [report](paper/shami_tts.pdf)):
1. **Dialectal front-end.** Automatic diacritization (CAMeL Tools) is now the *default* path,
so ~100% (not 0.4%) of bare conversational text is phonemized through the high-quality
Levantine rule-G2P. A new **de-desinentialization** step strips MSA case/mood endings that
Levantine drops (`ู
ูููุนูุฏ` โ `moหสid`, not `moหสidi`) while preserving gemination.
โ Levantine CER 0.75 โ 0.46.
2. **Deterministic duration head.** Replaces VITS's stochastic duration predictor (which
under-predicted ~3ร, forcing a prosody-flattening global stretch) with a deterministic
head trained by MSE on alignment durations. Natural rhythm at `length_scale=1`.
โ CER 0.46 โ **0.11** (the roboticโnatural unlock).
3. **24 kHz fidelity + texture recipe.** Decoder fine-tuned to native 24 kHz; feature-matching
up-weighted; the discriminator is now **persisted across warm-starts** (it used to restart
from scratch โ a real bug that caused buzz); a multi-resolution STFT loss added.
โ full-band fidelity, buzz at reference level, CER flat.
4. **Anti-aliased BigVGAN vocoder.** Removes the residual high-frequency breathiness
(a phase/aliasing artifact) that magnitude losses can't fix. โ texture matches the source.
The story is two-regime: **intelligibility** is solved by data + duration (steep CER drop),
then **fidelity/texture** improvements (24 kHz, feature-matching, BigVGAN) hold CER while
raising perceptual quality โ which CER does not measure. Trust the audio in `samples/`.
---
## 2. Architecture
```
text (AR / EN / mixed)
โ normalize โ code-switch segment (script-based) โ per-span verbalize
โ diacritize (Arabic) + G2P (Levantine rules / espeak-ng English)
โ shared 88-symbol IPA + parallel language-ID stream
โ ShamiVITS acoustic model (mms-tts-ara backbone + IPA/lang embeddings
+ DETERMINISTIC duration head), 24 kHz
โ HiFi-GAN decoder โโโโโโโโโโโโโโโบ waveform (self-contained)
โโบ mel โบ BigVGAN vocoder โโโโโโบ waveform (cleanest) (highest fidelity)
```
- **Acoustic model (ShamiVITS):** ~36 M params. VITS core (CVAE + flow + monotonic alignment),
with the text-encoder embedding replaced by a shared IPA table, an additive language-ID
embedding, and the stochastic duration predictor swapped for the deterministic head.
*(In the reference code this is the `HamsVITS` class in the `hams_tts` package โ the import
path is unchanged for backward compatibility.)*
- **Vocoders:** native HiFi-GAN decoder (~inside VITS), or pretrained
[`nvidia/bigvgan_v2_24khz_100band_256x`](https://huggingface.co/nvidia/bigvgan_v2_24khz_100band_256x)
(112 M, MIT) โ an exact match for our 24 kHz / hop-256 pipeline, used with **no fine-tuning**.
---
## 3. Usage
Full code, front-end, and inference: **https://github.com/Al-aminI/hams-levantine-tts**
### 3a. HiFi-GAN (single model, minimal deps)
```python
import torch, soundfile as sf
from hams_tts.models.hams_vits import HamsVITS
from hams_tts.text.frontend import TextFrontend # needs espeak-ng + camel-tools for AR
fe = TextFrontend(diacritizer_backend="auto")
model = HamsVITS.from_checkpoint("path/to/this/repo").cuda().eval() # loads hams_vits.pt + config
u = fe.process("ู
ูุฑุญูุจุงุ ุฃูุง ู
ุณุงุนูุฏูู ุงูุตูุชูุ how can I help you today?")
pid = torch.tensor([u.phoneme_ids]).cuda(); lid = torch.tensor([u.language_ids]).cuda()
wav = model.infer(pid, lid, length_scale=1.0).squeeze().cpu().numpy() # 24 kHz
sf.write("out.wav", wav, model.sample_rate)
```
### 3b. + BigVGAN (highest fidelity)
```python
from hams_tts.inference.bigvgan_vocoder import synthesize # VITS โ BigVGAN โ trim
wav = synthesize(model, u.phoneme_ids, u.language_ids, length_scale=1.0)
sf.write("out_bigvgan.wav", wav, model.sample_rate)
```
BigVGAN is fetched from the Hub on first use (`use_cuda_kernel=False` โ pure-PyTorch,
Windows/CPU-safe). **Always synthesize at `length_scale=1.0`.**
---
## 4. Results (held-out set, n=40)
Consistently measured; ASR round-trip via Whisper large-v3, Arabic forced, text normalized
(diacritics/alef/ya/ta-marbuta folded). Full analysis in the [report](paper/shami_tts.pdf).
| System | Lev CER | Lev WER | CS CER | Overall CER | RTF |
|---|---|---|---|---|---|
| Published baseline (16 kHz, stochastic dur.) | 0.751 | 0.993 | 0.853 | 0.802 | 0.024 |
| **v2, HiFi-GAN (24 kHz)** | 0.113 | 0.377 | **0.498** | **0.305** | 0.028 |
| **v2, + BigVGAN** | **0.106** | **0.347** | 0.556 | 0.331 | ~0.085 |
**Texture:** high-frequency spectral flatness matches the reference (0.49โ0.51 vs 0.488).
**Duration:** ratio 0.97 at natural pacing. **Robustness:** 8/8 novel unseen sentences
(long, heavy code-switch, numbers/dates) synthesized cleanly.
> **On the code-switch CER column:** BigVGAN slightly *raises* it while *improving* pure
> Levantine and perceived quality. This is a **Whisper artifact** โ Whisper is MSA/English
> biased and mis-scores the English-in-Arabic segments; it is not an audible regression.
> Absolute CER via ASR has a floor well above zero on dialectal Arabic; treat **relative**
> numbers and the released audio as the source of truth. Human MOS is future work.
---
## 5. Training recipe (single RTX 3060, 12 GB, bf16)
Warm-started stages, each a fine-tune of the previous best:
```
prepare_lahgtna.py extract --target-sr 24000 โ phonemize (dialectal front-end)
finetune_gan.py --deterministic-duration --sample-rate 24000 --c-fm 4 --c-stft 3 \
--ckpt <prev-best> (generator + discriminator persisted, atomic saves)
eval_checkpoint.py --auto-ls --asr (sweep checkpoints; GAN is non-monotonic)
bigvgan_vocoder.synthesize (final vocoding)
```
Key HPs: AdamW(0.8,0.99), lr 2e-4, batch 12โ16, `seg_size` 8192โ12288, `c_mel`=45,
`c_dur`=1โ2, `c_fm`=4, `c_stft`=3, MR-STFT ffts 512/1024/2048, 8kโ10k steps/stage.
## 6. Data
[`mohammedaly22/lahgtna-levantine-tts`](https://huggingface.co/datasets/mohammedaly22/lahgtna-levantine-tts)
(CC-BY-4.0): 50k clips / 66.8 h / 24 kHz / 10 speakers, Shami Levantine + ~12% synthetic
code-switch, partially diacritized. This release = single speaker "Badr" (~6.2 h).
## 7. Limitations
Single speaker; small eval set (ยฑ0.02 CER noise); ASR-CER floor on dialectal Arabic
under-states true quality; BigVGAN path runs two vocoders (a single-pass melโBigVGAN model is
v3); multi-speaker is v3.
## 8. Licensing
- **Code:** Apache-2.0 (this project's source).
- **These weights:** **CC-BY-NC-4.0** โ derived from `facebook/mms-tts-ara` (Meta MMS), which
is non-commercial. **Non-commercial use only** unless you retrain from a permissive base.
- Dataset: CC-BY-4.0. BigVGAN: MIT. espeak-ng: GPLv3 (tool). CAMeL Tools: MIT/โฆ
## 9. Citation
```bibtex
@techreport{shami_tts_2026,
title = {Shami-TTS: A Production-Grade Streaming TTS for Levantine Arabic/English
Code-Switching via Dialectal Front-End, Deterministic Duration, and
Anti-Aliased Neural Vocoding},
author = {{Tushe Language Research Team}},
year = {2026},
institution = {Tushe Language Research},
note = {https://huggingface.co/Tushe/shami-tts}
}
```
Built on VITS (Kim et al., 2021), HiFi-GAN (Kong et al., 2020), BigVGAN (Lee et al., 2023),
MMS (Pratap et al., 2023), CAMeL Tools (Obeid et al., 2020), Whisper (Radford et al., 2023).
|