Wilga
Wilga is a small text-to-speech model for Polish (7 voices) and English (3 voices). Each language model has 5.95M parameters (24 MB ONNX), speaks at 24 kHz and runs on a CPU or in a web browser. Text is turned into phonemes by Wilga's own front end (numbers, dates, abbreviations and pronunciation rules), so no eSpeak and no GPU are needed.
- Try it in the browser: Wilga demo (runs on your device)
- Python:
pip install wilga, thenwilga.speak(text, language, voice)(PyPI) - Web: one JavaScript file, models load from this repository
- ONNX:
pl/model.onnx,en/model.onnxfor any runtime
Voice samples
Every voice reads the same two texts. Try your own text in the browser demo.
Polish — (1) „Dzień dobry! Nazywam się Wilga. Spotkanie przeniesiono na 14:30, więc mamy jeszcze ok. 45 minut.”
(2) „Czy możesz mi powiedzieć, która jest godzina? Bo chyba się spóźnimy na pociąg!”
| Voice | (1) | (2) | |
|---|---|---|---|
dorota (default) | mature woman | ||
marta | woman, warm | ||
zosia | young woman | ||
nela | young woman, melancholic | ||
tomasz | man, baritone | ||
kuba | young man | ||
jerzy | older man |
English — (1) "Hello! My name is Wilga. The meeting moved to 3:30 pm, so we have about 45 minutes left."
(2) "Could you tell me what time it is? I think we're going to miss the train!"
| Voice | (1) | (2) | |
|---|---|---|---|
emma (default) | woman | ||
james | man | ||
henry | man |
Quick start
Python
pip install wilga
import wilga
tts = wilga.load("pl") # downloads pl/model.onnx once (24 MB)
tts.save("Dzień dobry! Spotkanie jest o 14:30.", "dzien_dobry.wav", voice="marta")
audio = wilga.speak("Hello there!", language="en", voice="emma") # float32 numpy array, 24 kHz
print(wilga.voices()) # {'pl': (...), 'en': (...)}
Dependencies: numpy, onnxruntime and huggingface_hub (no PyTorch). Text of any length is read sentence by sentence.
speak and save also take speed (1.0 as predicted, larger is faster), pitch_shift (0.058 is about a semitone),
pitch_range and sentence_gap (seconds of silence between sentences).
Command line
wilga "Dzień dobry! Spotkanie jest o 14:30." -o dzien_dobry.wav
wilga "Hello there!" --language en --voice james -o hello.wav
wilga --list-voices
echo "Tekst z pliku." | wilga -o out.wav
Without installing anything: uvx wilga "Dzień dobry!" -o dzien_dobry.wav.
Browser
Copy web/wilga.js into your site (the models and the WebAssembly front ends are fetched from this repository and
cached by the browser):
<script type="module">
import { loadWilga, toWav } from "./wilga.js";
const tts = await loadWilga("pl"); // or "en"
const audio = await tts.speak("Dzień dobry!", { voice: "marta", speed: 1.0 });
new Audio(URL.createObjectURL(toWav(audio, tts.sampleRate))).play();
</script>
web/worker.js runs the same off the main thread, and web/index.html is the demo page. Everything runs on the
user's device; ONNX Runtime Web is loaded from jsDelivr.
ONNX directly
pl/model.onnx and en/model.onnx take phoneme ids and return the waveform. Get the ids with
wilga.Wilga(language).phonemize(text) (Python) or tts.phonemize(text) (JavaScript).
| Input | Type | Shape | Meaning |
|---|---|---|---|
tokens | int64 | [1, N] | phoneme ids with the start and end tokens (symbols in pl/config.json, en/config.json) |
stress | int64 | [1, N] | 0 none, 1 primary, 2 secondary |
voice | int64 | [1] | index into voices in the language's config |
speed, pitch_shift, pitch_range | float32 | [1] | 1.0, 0.0, 1.0 = as predicted |
express | float32 | [1, 2] | zeros = the voice's typical delivery |
Outputs: audio float32 [1, samples] at 24 kHz and durations int64 [1, N] (frames of 256 samples per token).
One call reads one utterance of up to 512 tokens.
Voices
| Language | Voice | Source | |
|---|---|---|---|
| pl | dorota (default) | mature woman | synthetic, designed from a text description |
| pl | marta | woman, warm | synthetic, designed from a text description |
| pl | zosia | young woman | synthetic, designed from a text description |
| pl | nela | young woman, melancholic | synthetic, designed from a text description |
| pl | tomasz | man, baritone | synthetic, designed from a text description |
| pl | kuba | young man | synthetic, designed from a text description |
| pl | jerzy | older man | synthetic, designed from a text description |
| en | emma (default) | woman | recorded: Hi-Fi TTS speaker 92 (LibriVox, CC BY 4.0) |
| en | james | man | recorded: Hi-Fi TTS speaker 6097 (LibriVox, CC BY 4.0) |
| en | henry | man | recorded: Hi-Fi TTS speaker 9017 (LibriVox, CC BY 4.0) |
All Polish voices are synthetic and do not belong to any real person: each was designed with VoxCPM2 from a written
description of a voice, and VoxCPM2 then read training sentences in that voice. Samples of every voice are in
samples/ (texts in samples/texts.json).
Results
Intelligibility is the word error rate (WER) of Whisper large-v3 transcripts of the synthesized speech. Each test set was chosen before the run and scored once.
Polish
| Wilga | same model with the eSpeak NG front end | |
|---|---|---|
| WER, 1500 random sentences from Polish Wikipedia (spoken-form references) | 9.05 % | 11.96 % |
| same, sentences with Cyrillic or Greek words (41) | 26.7 % | 95.1 % |
| WER, 360 held-out sentences of the training voices | 0.69 % | 0.93 % |
| Words pronounced as in Wiktionary (30,386 test words) | 99.08 % | 98.31 % |
The reference of the Wikipedia test is each sentence written out as it is read aloud (numbers, dates and abbreviations in words), so that reading "ur." as "urodzona" is not counted as an error. On Latin-script sentences most of the gain comes from the text normalizer; eSpeak NG given the same normalized text is as intelligible (8.66 % vs 8.60 %). UTMOS (predicted naturalness, 1-5) averages 3.68 over the seven voices.
English
| Wilga | tiny-voca (original English model) | same model with eSpeak NG | |
|---|---|---|---|
| WER, 1500 random sentences from English Wikipedia | 3.86 % | 4.00 % | 4.55 % |
| UTMOS (predicted naturalness) | 4.18 | 4.41 | |
| Heteronyms read as their context needs (record, live, read ...), audible in the speech | 89.9 % | 79.8 % |
The English model is as intelligible as tiny-voca (difference -0.14 points, 95 % interval -0.39 to +0.11), but its predicted naturalness is lower and it is slower (see below).
Speed. Text to audio with the Python package, ONNX Runtime on 4 CPU threads: ~70× faster than real time in both languages (~2.5× faster than v0.2.1 thanks to the neural iSTFT vocoder, and 24.2 MB instead of 32.6 MB). The front end takes about 1 ms per Polish and 10 ms per English sentence in Python, and 0.5 ms and 5 ms in WebAssembly.
Model
The architecture builds on tiny-voca (Apache-2.0) with a compact neural iSTFT vocoder (5.95M total inference parameters, 24.2 MB ONNX). A transformer encoder (4 blocks) reads phonemes with stress, a duration predictor gives each phoneme a length, and two frame-level transformers (2 and 5 blocks, 192 channels) predict pitch, voicing, energy and acoustic features. Starting in v0.3.0, the deterministic pulse-train source-filter synthesizer is replaced by a ConvNeXt neural iSTFT vocoder (160 channels, 6 blocks, 1024-point FFT, 256-sample hop) that directly predicts STFT magnitude and phase — eliminating metallic vocoder buzz while doubling CPU inference speed. Models are further fine-tuned with rising-question oversampling and terminal pitch weighting for more natural question intonation in both Polish and English. No weights come from tiny-voca or any other TTS model.
Training data
- Polish: 18.3 h of VoxCPM2 speech in the seven designed voices (1.8 to 3.6 h each) and MC Speech (20.1 h, one speaker, CC0), from scratch. The MC Speech voice was used for training only and is not part of the release.
- English: Hi-Fi TTS "clean", speakers 92, 6097 and 9017 (43.6 h, CC BY 4.0, recordings from LibriVox), starting from the Polish model's weights.
- Pretrained models were used only to label and evaluate data (forced alignment, Whisper, UTMOS, and local LLMs that wrote training labels for the numeral classifier and the list of English words in Polish text); none is part of Wilga.
Front ends. Polish: a normalizer with case and gender agreement (a 0.6M-parameter numeral classifier plus rules for
fractions, units such as m³/V/+21°C, negation genitive, addresses, ranges, and discourse enumerators),
pronunciation rules, tables generated from PoliMorf (prefix boundaries, inflected English loans) and Cyrillic and
Greek transliteration. English: CMUdict, a letter-to-sound model for unknown words, heteronym rules and General
American connected-speech rules. The Python and WebAssembly versions give the same phonemes.
Limitations
- Prosody is predominantly calm reading style; while v0.3.0 substantially improves rising yes/no question intonation, highly expressive or dramatic delivery is outside the training domain.
- Rare Polish sibilant contexts (an affricate at the very end of an utterance, initial "dż") can occasionally soften.
- Scripts other than Latin, Cyrillic and Greek are skipped.
Licence and attribution
CC BY-NC 4.0 (Creative Commons Attribution-NonCommercial 4.0 International) for the code, the models and the front-end data; see LICENSE and NOTICE. The English voices are
trained on Hi-Fi TTS (Bakhturina et al., 2021, CC BY 4.0), made from LibriVox recordings by readers 92, 6097 and
9017. The Polish model is also trained on MC Speech (Czyżnikiewicz, 2022, CC0). The pronunciation dictionary CMUdict
(Carnegie Mellon University, BSD-2-Clause) is included with its licence. Two tables of the Polish front end are
derived from PoliMorf (Woliński, Miłkowski, Ogrodniczuk, Przepiórkowski, 2012; BSD-2-Clause).
Po polsku
Wilga to mały model syntezy mowy dla języka polskiego (7 głosów) i angielskiego (3 głosy), działający na CPU
i w przeglądarce. Instalacja: pip install wilga, potem
wilga "Dzień dobry!" -o dzien_dobry.wav albo wilga.load("pl").save(tekst, "plik.wav", voice="marta").
Liczby, daty, godziny i skróty są czytane słownie, z odmianą („z 5 kotami” → „z pięcioma kotami”). Wszystkie polskie
głosy są syntetyczne (zaprojektowane z opisu słownego w VoxCPM2), nie należą do prawdziwych osób.