File size: 11,726 Bytes
adabee1 25da950 adabee1 | 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 | ---
license: apache-2.0
language:
- da
pipeline_tag: text-to-speech
library_name: onnx
base_model: n4ze3m/tiny-voca
datasets:
- CoRal-project/coral-tts
tags:
- text-to-speech
- tts
- danish
- onnx
- tiny
- cpu
- edge
---
# tiny-voca-da
A small Danish text-to-speech model, ported from [tiny-voca](https://huggingface.co/n4ze3m/tiny-voca).
- **6.8 M parameters**: a 4.56 M voice model plus a 2.22 M neural vocoder. Both are in one ONNX graph.
- **9.3 MB** as int8 ONNX (28 MB fp32). It runs about 60× faster than real time on 2 CPU threads.
- One voice (`DA1`), 24 kHz, trained on real Danish recordings.
- Version 0.1 (2026-11-27). This is a research preview. No native Danish speaker has reviewed it yet;
correctness was checked with speech recognition only.
## 🎧 Listen
Every clip below comes straight from `speak.py` with the 9 MB int8 model on a CPU.
| Danish text | Audio |
|---|---|
| Hej og velkommen! Jeg er en lille dansk stemme, og jeg kører direkte på din egen computer, helt uden internet.<br>*Hello and welcome! I'm a small Danish voice, and I run right on your own computer, no internet needed.* | <audio controls src="https://huggingface.co/gowombat/tiny-voca-da/resolve/main/samples/showcase_welcome.wav"></audio> |
| Toget mod Aarhus afgår fra spor 3 om 12 minutter, og en billet koster 129 kroner.<br>*Numbers are read as words.* | <audio controls src="https://huggingface.co/gowombat/tiny-voca-da/resolve/main/samples/showcase_numbers.wav"></audio> |
| Mødet starter klokken 14.30 og slutter klokken 16.<br>*Times.* | <audio controls src="https://huggingface.co/gowombat/tiny-voca-da/resolve/main/samples/showcase_time.wav"></audio> |
| I dag er det fredag den 27. november 2026.<br>*Dates and years.* | <audio controls src="https://huggingface.co/gowombat/tiny-voca-da/resolve/main/samples/showcase_date.wav"></audio> |
| Husk f.eks. at slukke lyset, når du går. Det sparer bl.a. strøm og penge.<br>*Abbreviations are expanded: f.eks. → for eksempel, bl.a. → blandt andet.* | <audio controls src="https://huggingface.co/gowombat/tiny-voca-da/resolve/main/samples/showcase_abbrev.wav"></audio> |
| Danmark består af halvøen Jylland og 443 navngivne øer. Den største by er København, som også er landets hovedstad.<br>*A longer passage.* | <audio controls src="https://huggingface.co/gowombat/tiny-voca-da/resolve/main/samples/showcase_long.wav"></audio> |
| Hun går en tur med sin hund hver morgen.<br>*"hun" (she) and "hund" (dog) differ only by stød, the Danish glottal catch.* | <audio controls src="https://huggingface.co/gowombat/tiny-voca-da/resolve/main/samples/showcase_stoed.wav"></audio> |
| Hun. · Hund.<br>*The same stød pair, one word at a time.* | <audio controls src="https://huggingface.co/gowombat/tiny-voca-da/resolve/main/samples/showcase_hun.wav"></audio><br><audio controls src="https://huggingface.co/gowombat/tiny-voca-da/resolve/main/samples/showcase_hund.wav"></audio> |
| Bønder. · Bønner.<br>*Farmers and beans: another stød pair.* | <audio controls src="https://huggingface.co/gowombat/tiny-voca-da/resolve/main/samples/showcase_bonder.wav"></audio><br><audio controls src="https://huggingface.co/gowombat/tiny-voca-da/resolve/main/samples/showcase_bonner.wav"></audio> |
| Rødgrød med fløde.<br>*The classic Danish tongue-twister.* | <audio controls src="https://huggingface.co/gowombat/tiny-voca-da/resolve/main/samples/showcase_rodgrod.wav"></audio> |
More: `samples/` holds all 20 test sentences (`samples/probes_da.jsonl`) and the showcase texts
(`samples/showcase.jsonl`).
## Files
| path | what |
|---|---|
| `onnx/model-int8.onnx`, `onnx/model-int8.json` | int8 model (MatMul/Gemm weights only) and its metadata (symbols, frontend fingerprint) |
| `onnx/model.onnx`, `onnx/model.json` | the same model in fp32 |
| `pytorch/voice.pt`, `pytorch/vocoder.pt` | PyTorch weights for the tiny-voca-it code with the Danish patches |
| `frontend/` | the Danish text-to-phoneme frontend (v4), described below |
| `speak.py` | text → WAV with the ONNX model |
| `samples/` | 20 rendered test sentences |
| `eval/` | evaluation reports |
| `recipe/` | the full training recipe: Dockerfiles, compose file, scripts, kit |
## Run it
The model reads phoneme IDs, so it needs **the exact frontend it was trained with**. `speak.py` checks this
with the frontend fingerprint in `onnx/*.json`. The tested route is Docker; the image holds the patched code,
eSpeak NG and the Python packages:
```bash
git clone https://huggingface.co/gowombat/tiny-voca-da && cd tiny-voca-da/recipe
cp ../frontend/da_g2p_nst_v1.pt ../frontend/da_g2p_nst_v1.symbols.json ../frontend/danish_g2p_data.py kit-v4/resources/
docker compose build kit-v3 && docker compose --profile tools build g2p && docker compose build kit-v4
cd .. && docker run --rm --user "$(id -u):$(id -g)" -v "$PWD:/release" -w /release tiny-voca-dk:v4 \
python speak.py "Hej! Hvordan går det? I dag er det fredag den 27. november." --output hej.wav
```
The images are built for CUDA training, so they are large (about 14 GB). For CPU-only use, follow the same
steps by hand (`recipe/docker/Dockerfile` and `recipe/docker/Dockerfile.v4`):
1. Check out [tiny-voca-it](https://github.com/carbogninalberto/tiny-voca-it) at `3af29adc2b9dc0a0441fb1d8bb3507e1a7e0fc05`.
2. Apply `frontend/danish.patch`, then `frontend/danish-v4.patch`.
3. Copy the G2P files into `src/tiny_voca/resources/` and `danish_g2p_data.py` into `src/tiny_voca/`.
4. Install `deep-phonemizer==0.0.19`, `lingua-language-detector==2.1.1` and `onnxruntime`.
5. Build eSpeak NG 1.52.0 with `recipe/kit-v3/install_espeak.sh`.
This manual route has not been tested outside Docker.
## How it was made
- **Start**:
- weights of the English [n4ze3m/tiny-voca](https://huggingface.co/n4ze3m/tiny-voca) (rev `5fe0664`);
- code [carbogninalberto/tiny-voca-it](https://github.com/carbogninalberto/tiny-voca-it) (`3af29ad`) plus the
Danish patches.
- **Data**: [CoRal-tts](https://huggingface.co/datasets/CoRal-project/coral-tts) (CC0-1.0), speaker `mic`.
- Silent edges trimmed.
- Clips kept only if they pass the alignment checks: 5755 training clips (8.3 h), 293 validation, 289 test.
- **Frontend v4** (text → phonemes, with stød):
- the [NST Danish pronunciation lexicon](https://www.nb.no/sprakbanken/ressurskatalog/en/oai-nb-no-sbr-26/) (CC0);
- words missing from it: a [DeepPhonemizer](https://github.com/as-ideas/DeepPhonemizer) transformer trained here
on NST itself.
- It gets 83% of held-out words exactly right, with a phoneme error of 3.2% and stød recall of 94%.
- It outputs NST's own symbols, stød included.
- English sentences and phrases are detected with [lingua](https://github.com/pemistahl/lingua-py) and read by
eSpeak NG's English voice, mapped into the Danish sound set;
- numbers via `num2words` plus rules (`enog…` numbers derived from NST), abbreviations (`bl.a.`, `f.eks.`, …)
and symbols (`&`, `§`, `+`, `=`);
- eSpeak NG's Danish voice only for what is left: 0.3% of training words, mostly initialisms.
- **Voice model**:
- 100k steps, all weights trained, adversarial loss from step 8k;
- a spectral texture loss above 1 kHz up to step 180k;
- the last 40k steps on frontend-v4 labels (220k in total).
- **Vocoder**:
- a small neural vocoder with a glottal-pulse prior, distilled from [Vocos](https://github.com/gemelo-ai/vocos),
132k steps;
- then 20k steps fitted to this voice model's own output, with the target smoothed over 9 frames. This
brings the buzz down to the level of the real recordings.
- Trained in Docker on two 16 GB GPUs. `recipe/` holds every script.
## Evaluation
- **Correctness**: Whisper large-v3 reads back 120 held-out validation sentences; CER and WER are
character and word error rates, lower is better.
- **Sound**: DNSMOS (P808, SIG, OVRL) and UTMOS on the 20 test sentences, higher is better.
- **Buzz**: pulse locking at 1–2 / 2–4 / 4–6 kHz; lower is less buzzy, and the real recordings are the target.
| | CER | WER | P808 | SIG | OVRL | UTMOS | buzz |
|---|---|---|---|---|---|---|---|
| real recordings ¹ | 8.07% | | 3.70 | 3.53 | 3.29 | 3.44 | 0.33 / 0.31 / 0.24 |
| **this model** | **7.15%** | 14.2% | 3.43 | 3.34 | 3.07 | 3.10 | 0.29 / 0.30 / 0.24 |
| same recipe, older frontend v3 ² | 8.13% | 15.6% | 3.40 | 3.34 | 3.07 | 3.16 | 0.30 / 0.31 / 0.25 |
¹ CER is on the same 120 sentences. The sound and buzz scores are on recorded clips, not the same sentences.
² Equal training steps and the same vocoder recipe. Two other things differ:
- The v3 frontend had no G2P or English reader, so 8.5% of words fell back to eSpeak, which has no stød.
- Fewer clips passed the alignment checks under v3: 4589, against 5755 here.
Notes:
- With 120 sentences, a one-point CER difference is within the noise. The gain held with a second
vocoder as well: 7.23% against 8.16%.
- UTMOS is trained on English, so only compare it within this table.
- ONNX check: 20 of 20 test sentences pass, for both the fp32 and the int8 model (`eval/*-check.json`).
## Limitations
- One voice, from crowd-sourced recordings with some room tone. It sounds less clean than English tiny-voca,
which was trained on clean synthetic speech.
- No native speaker has reviewed it. Expect some wrong vowel lengths or stød on rare words and names, which the
G2P has to guess.
- English words are read with English sounds squeezed into the Danish sound set, and initialisms are spelled.
- The model synthesises a whole sentence at a time, so it doesn't stream. `speak.py` splits longer text at
sentence ends.
- The voice is the CoRal-tts speaker `mic`, recorded for a public CC0 TTS dataset. Don't use it to impersonate
anyone or to deceive. Tell listeners that the speech is synthetic.
## Small devices
The model needs about 0.5 G multiply-adds per second of speech, once the STFT parts are done as FFTs, and its
int8 weights are 9 MB. An ESP32-S3 or ESP32-P4 looks feasible. That is an estimate only, not measured on
hardware. The frontend can run on a phone or server and send phoneme IDs instead.
## Licences and credits
This model, `speak.py` and the recipe are **Apache-2.0** (`LICENSE`). It builds on:
| component | licence | role |
|---|---|---|
| [tiny-voca](https://huggingface.co/n4ze3m/tiny-voca), Muhammed Nazeem | Apache-2.0 | starting weights, architecture |
| [tiny-voca-it](https://github.com/carbogninalberto/tiny-voca-it), carbogninalberto | Apache-2.0 | code base |
| [CoRal-tts](https://huggingface.co/datasets/CoRal-project/coral-tts), CoRal project | CC0-1.0 | training recordings |
| [NST Danish lexicon](https://www.nb.no/sprakbanken/ressurskatalog/en/oai-nb-no-sbr-26/), Språkbanken | CC0-1.0 | pronunciation lexicon (inside `danish.patch`), G2P training data |
| [DeepPhonemizer](https://github.com/as-ideas/DeepPhonemizer) | MIT | G2P model code |
| [lingua](https://github.com/pemistahl/lingua-py) | Apache-2.0 | language detection |
| [Vocos](https://github.com/gemelo-ai/vocos) | MIT | vocoder teacher (training only) |
| [wav2vec2-lv-60-espeak-cv-ft](https://huggingface.co/facebook/wav2vec2-lv-60-espeak-cv-ft) | Apache-2.0 | phoneme alignment (training only) |
| [Whisper large-v3](https://huggingface.co/openai/whisper-large-v3) | Apache-2.0 | evaluation only |
| [eSpeak NG](https://github.com/espeak-ng/espeak-ng) 1.52.0 | GPL-3.0 | separate program, **not included**; the recipe builds it |
Please also cite tiny-voca:
```bibtex
@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}
}
```
|