Commit ·
f21d6eb
0
Parent(s):
kale-tts-1
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +60 -0
- GUIDE.md +216 -0
- LICENSE +202 -0
- README.md +411 -0
- SHA256SUMS +30 -0
- THIRD_PARTY_NOTICES.md +111 -0
- checkpoints/README.md +15 -0
- checkpoints/packs/d03.pt +3 -0
- checkpoints/packs/d13.pt +3 -0
- checkpoints/packs/f06.pt +3 -0
- checkpoints/packs/h013f.pt +3 -0
- checkpoints/packs/m3.pt +3 -0
- checkpoints/packs/s057b.pt +3 -0
- checkpoints/packs/t071.pt +3 -0
- checkpoints/packs/w165.pt +3 -0
- checkpoints/packs/w602.pt +3 -0
- checkpoints/packs/x328.pt +3 -0
- checkpoints/teacher/kokoro_teacher.pth +3 -0
- checkpoints/tiny/decoder_flkd.pt +3 -0
- checkpoints/tiny/decoder_t10k.pt +3 -0
- checkpoints/tiny/duration_head_fld.pt +3 -0
- checkpoints/tiny/duration_head_t10d2.pt +3 -0
- checkpoints/tiny/ettin_text_side_fle.pt +3 -0
- checkpoints/tiny/ettin_text_side_t10e.pt +3 -0
- checkpoints/tiny/pitch_heads_flp.pt +3 -0
- checkpoints/tiny/pitch_heads_t10p.pt +3 -0
- config.json +6 -0
- diagrams/benches.png +3 -0
- diagrams/birth.png +3 -0
- diagrams/data.png +3 -0
- diagrams/datacontents.png +3 -0
- diagrams/datamade.png +3 -0
- diagrams/demo-nano.png +3 -0
- diagrams/demo-tiny.png +3 -0
- diagrams/extend.png +3 -0
- diagrams/flow-nano.png +3 -0
- diagrams/flow-tiny.png +3 -0
- diagrams/header-base.png +3 -0
- diagrams/header-data.png +3 -0
- diagrams/header-nano.png +3 -0
- diagrams/header-tiny.png +3 -0
- diagrams/madeof-nano.png +3 -0
- diagrams/madeof-tiny.png +3 -0
- diagrams/measure.png +3 -0
- diagrams/phonemes.png +3 -0
- diagrams/soundside-nano.png +3 -0
- diagrams/soundside.png +3 -0
- diagrams/textside-nano.png +3 -0
- diagrams/textside.png +3 -0
- diagrams/voices.png +3 -0
.gitattributes
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
runtimes/pipecat/out.pcm filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
runtimes/wyoming/out.pcm filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
diagrams/benches.png filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
diagrams/data.png filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
diagrams/extend.png filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
diagrams/phonemes.png filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
diagrams/soundside.png filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
diagrams/textside.png filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
diagrams/voices.png filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
diagrams/soundside-nano.png filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
diagrams/textside-nano.png filter=lfs diff=lfs merge=lfs -text
|
| 47 |
+
diagrams/demo-nano.png filter=lfs diff=lfs merge=lfs -text
|
| 48 |
+
diagrams/demo-tiny.png filter=lfs diff=lfs merge=lfs -text
|
| 49 |
+
diagrams/header-nano.png filter=lfs diff=lfs merge=lfs -text
|
| 50 |
+
diagrams/header-tiny.png filter=lfs diff=lfs merge=lfs -text
|
| 51 |
+
diagrams/flow-nano.png filter=lfs diff=lfs merge=lfs -text
|
| 52 |
+
diagrams/flow-tiny.png filter=lfs diff=lfs merge=lfs -text
|
| 53 |
+
diagrams/madeof-nano.png filter=lfs diff=lfs merge=lfs -text
|
| 54 |
+
diagrams/madeof-tiny.png filter=lfs diff=lfs merge=lfs -text
|
| 55 |
+
diagrams/measure.png filter=lfs diff=lfs merge=lfs -text
|
| 56 |
+
diagrams/datacontents.png filter=lfs diff=lfs merge=lfs -text
|
| 57 |
+
diagrams/datamade.png filter=lfs diff=lfs merge=lfs -text
|
| 58 |
+
diagrams/header-base.png filter=lfs diff=lfs merge=lfs -text
|
| 59 |
+
diagrams/header-data.png filter=lfs diff=lfs merge=lfs -text
|
| 60 |
+
diagrams/birth.png filter=lfs diff=lfs merge=lfs -text
|
GUIDE.md
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!-- DRAFT, NOT PUBLISHED. Nothing here goes public until the go. Built 16 Nov 2026 from our research notes; no product voice, no internal
|
| 2 |
+
names, no private data, no secrets. Licences: weights and code Apache-2.0, dataset CC BY 4.0 (final, 16 Nov). -->
|
| 3 |
+
|
| 4 |
+
# Build your own voice with kale-tts-1
|
| 5 |
+
|
| 6 |
+
This is the full recipe behind kale-tts-1-nano (~10 MB, one ONNX file, several voices, runs on a phone-class CPU). Use it to make a small,
|
| 7 |
+
fast model in any voice you can describe in one sentence. Every number below was measured on our bench; failures are included where they
|
| 8 |
+
cost us time, so you can skip them.
|
| 9 |
+
|
| 10 |
+
The pipeline:
|
| 11 |
+
1. design a voice in Maya-1 (text description, no recordings),
|
| 12 |
+
2. render ~25 hours of it,
|
| 13 |
+
3. filter hard,
|
| 14 |
+
4. train a teacher and a small sound side,
|
| 15 |
+
5. distil the text side to nano size,
|
| 16 |
+
6. export to ONNX,
|
| 17 |
+
7. run it anywhere onnxruntime runs.
|
| 18 |
+
|
| 19 |
+
## 0. What you need
|
| 20 |
+
- GPUs for rendering, filtering and training (we used H100s; one voice end to end needs a few GPU-hours, see costs at each step).
|
| 21 |
+
- Maya-1 (Apache-2.0) with SNAC 24 kHz (MIT), vLLM, Whisper large-v3-turbo (MIT), a speaker-embedding model for voice checks, Kokoro-82M
|
| 22 |
+
(Apache-2.0) as the teacher's starting point, kikiri-tts / StyleTTS2 training code (Apache-2.0 / MIT).
|
| 23 |
+
- This folder: `frontend/` (text front end), `python/kale_tts.py`, `js/kale-tts.mjs`, `server/server.mjs`, `runtimes/`.
|
| 24 |
+
- `recipe/` (the scripts that built the release; each step's README lists its inputs and outputs; app and volume names in
|
| 25 |
+
`recipe/config/modal.json`): `render/` (text pool, voice descriptions in `render/config/voices.json`, Maya-1 render), `filter/`,
|
| 26 |
+
`teacher/`, `train/`, `distil/`, `bench/` (incl. `melody_gap.py`), `export/` (training exports -> the release files: one-file graphs,
|
| 27 |
+
exact rewrites, end clamp, fp32 web graph, export check; `build_release.sh`).
|
| 28 |
+
|
| 29 |
+
## 1. Design the voice (Maya-1)
|
| 30 |
+
Write one description in Maya-1's own format: identity, then delivery. Example (Simone, one of the release voices):
|
| 31 |
+
> Realistic female voice in the 40s age with a african american accent. Low pitch, deep timbre, conversational pacing, confident tone delivery at medium intensity, conversational domain, narrator role, natural delivery
|
| 32 |
+
|
| 33 |
+
What we learned designing ~500 candidates:
|
| 34 |
+
- **The accent slot sets identity most.** By speaker embedding (ECAPA), two designs with the same accent are +0.28 more alike; the same
|
| 35 |
+
pitch adds +0.08; age adds almost nothing. For variety inside one language, use the accent slot (e.g. "southern american",
|
| 36 |
+
"new york", "midwestern") and distinct character roles (person + situation + delivery). Light regional hints in free text barely move it.
|
| 37 |
+
- **The pacing word sets the pace.** On the same voice: "brisk" ~226 words/min, "conversational" ~201, "moderate" ~200. A "slow pacing"
|
| 38 |
+
design stays slow; change the word, don't speed the audio up. Lines made of many short sentences also read slow (~150 wpm): use flowing
|
| 39 |
+
clauses in your test line.
|
| 40 |
+
- **Check distinctness with ECAPA, not WavLM speaker verification.** WavLM-sv rates most designed voices >= 0.965 alike. With ECAPA, a
|
| 41 |
+
take to its own voice's centre is ~0.94; voices listeners heard as different sat at 0.75-0.78; "too similar" at 0.86-0.89. We keep a
|
| 42 |
+
new voice below 0.80 to every voice already in the model.
|
| 43 |
+
- Render 12-16 takes of a test line per design and keep a design only if at least 2 takes are clean (see step 3) and the pace lands
|
| 44 |
+
where you want it (we aim at 160-200 wpm).
|
| 45 |
+
- Whisper-style delivery works; laughs and giggles are unreliable (Maya often skips them), so a small model can't learn them cleanly.
|
| 46 |
+
- Ages and accents the model can't do convincingly come out generic or put-on. Listen before you train; don't trust an accent classifier.
|
| 47 |
+
- Adults only, designed only: never describe or imitate a real person.
|
| 48 |
+
|
| 49 |
+
## 2. Render (`recipe/render/`)
|
| 50 |
+
- Maya-1 on vLLM, bf16. Sampling: temperature 0.4, top-p 0.9, repetition penalty 1.1, max tokens min(2048, 220 + 60 x words), one seed per
|
| 51 |
+
take. Decode SNAC codes to 24 kHz audio. Keep the original audio, no processing.
|
| 52 |
+
- Throughput: 46,000 takes (118 h of audio) in ~17 minutes on 4 H100s.
|
| 53 |
+
- Text: public-domain Project Gutenberg books (boilerplate removed; `recipe/render/make_text.py`). Mix single sentences and passages of 2-5 consecutive
|
| 54 |
+
sentences, by item count 40 / 20 / 20 / 12 / 8 %, each 1-20 s (Maya-1 stops around 25 s). Never glue unrelated sentences together.
|
| 55 |
+
- Render more than you keep: ~21k items for a female voice, ~50k for a male voice (male takes fail the ending check more often).
|
| 56 |
+
- **Bug to avoid:** with a warm vLLM engine, outputs may not come back in prompt order. Match each output to its job by the prompt tokens,
|
| 57 |
+
or takes land on the wrong text and voice.
|
| 58 |
+
|
| 59 |
+
## 3. Filter (`recipe/filter/`: `stream_filter.py` + `keep.py`)
|
| 60 |
+
Run every check on each chunk as it renders, in the same warm GPU container (Maya, SNAC, Whisper, quality and speaker models loaded once).
|
| 61 |
+
A batch pass after the render took us hours; streaming screened ~100 voices end to end in ~5 minutes.
|
| 62 |
+
|
| 63 |
+
Keep a take only if:
|
| 64 |
+
| check | rule |
|
| 65 |
+
|---|---|
|
| 66 |
+
| complete | Maya's end token is present |
|
| 67 |
+
| read-back | Whisper large-v3-turbo reads the text back with no missed and no extra words |
|
| 68 |
+
| edges | 20 ms-0.8 s of silence before, at most 0.8 s after; not cut off; no full-scale sample |
|
| 69 |
+
| pace | 100-230 spoken words/min (raise the ceiling for a voice whose natural pace is faster) |
|
| 70 |
+
| pitch | within 15 % of the voice's median |
|
| 71 |
+
| same voice | ECAPA-TDNN cosine >= 0.46 to the voice's own centre (mean of its closest 60 % of takes); our release pass used WavLM-sv at 0.88, replaced because its pretraining data is non-commercial (`recipe/filter/keep.py`) |
|
| 72 |
+
| endings | a rough-ending (creak / cut-off) detector on EVERY sentence end, found by forced alignment, < 100 ms rough; pitch floor 70 Hz for male voices, 110 Hz for female |
|
| 73 |
+
| passages | one rough inner sentence end drops the whole take |
|
| 74 |
+
|
| 75 |
+
What we learned:
|
| 76 |
+
- **Check every sentence end, not just the last one, and not by pauses.** A pause-based pass let creaky inner endings through.
|
| 77 |
+
- **A creak detector tuned on female voices deletes male voices.** A stricter detector flagged nearly every normal low male ending,
|
| 78 |
+
including clean single sentences: it dropped 93 % of one male voice's takes (the standard detector with a 70 Hz floor kept 81-90 %).
|
| 79 |
+
- Expect 44-63 % of female takes and fewer male takes to survive.
|
| 80 |
+
- More hours of a creaky voice don't fix creak; filtering does.
|
| 81 |
+
|
| 82 |
+
**How many hours** (same voice trained on 5 h, 25 h and all of its kept takes, everything else equal; 192-line bench, 3 seeds):
|
| 83 |
+
| voice | 5 h unclear % | 25 h | all | voice's own Maya takes |
|
| 84 |
+
|---|---|---|---|---|
|
| 85 |
+
| deep-voiced woman (34 h total) | 5.36 | 3.97 | 3.81 | 3.19 |
|
| 86 |
+
| calm older man (59 h total) | 5.08 | 4.79 | 4.52 | 4.04 |
|
| 87 |
+
- Aim for **~25 hours kept per voice**. 5 h works but is less clear and reads slow; more than 25 h adds 0.2-0.3 points.
|
| 88 |
+
- Sound quality is already at its level with 5 h. Melody keeps improving with hours only for lively voices.
|
| 89 |
+
- The duration model needs **at least ~1.5 h of takes inside the voice's pace window** (step 4), or the voice reads slow.
|
| 90 |
+
|
| 91 |
+
## 4. Train
|
| 92 |
+
### 4a. Teacher text side (`recipe/teacher/`)
|
| 93 |
+
- Start from stock Kokoro-82M. Fine-tune it on your voices only with StyleTTS2 training: train your own text aligner on the voices first
|
| 94 |
+
(10 epochs, ~30 min), then stage 1 (3 epochs) and stage 2 for **one epoch only** (later stage-2 epochs cost clarity and melody in our runs).
|
| 95 |
+
One GPU: multi-GPU stage 1 ran out of memory in every rank for us.
|
| 96 |
+
- Loading older checkpoints: weight-norm key names differ between code versions, and a non-strict load silently leaves the pitch branch
|
| 97 |
+
random. Rename the keys, fail on any missing tensor, and check that the predicted pitch is in a human range.
|
| 98 |
+
- Voice packs (style vectors) come from the teacher's style encoder over ~200 of the voice's own takes. These barely separate voices
|
| 99 |
+
(packs are 0.96-0.99 alike), so each voice also gets learned rows and offsets (below).
|
| 100 |
+
- **Open:** the symbols the text side is trained on matter for melody. A Kokoro text side trained on Kokoro's own symbol conventions
|
| 101 |
+
kept a much more natural melody than the same model trained on espeak-style IPA (melody gap 1.6-1.8 vs 4.5 on our scale, same clarity).
|
| 102 |
+
We are retraining our teacher on Kokoro-native symbols; check the release notes for the result before you train.
|
| 103 |
+
|
| 104 |
+
### 4b. Sound side (`recipe/train/`)
|
| 105 |
+
- A 3.65 M-parameter decoder: AdaIN trunk, a 64-harmonic sine source plus noise, and an iSTFT head straight to 24 kHz (no separate vocoder).
|
| 106 |
+
One learned 16-number style row per voice.
|
| 107 |
+
- From scratch: 50k steps (25k spectral, 25k adversarial), then continue to ~80k steps (50k -> 80k: unclear 4.71 -> 4.50 %, weakest-tenth
|
| 108 |
+
sound 4.16 -> 4.38). Don't restart the learning-rate schedule to go further: it cost clarity at 100k-150k.
|
| 109 |
+
- An 8.4 M decoder tied the 3.65 M one; it isn't worth the size.
|
| 110 |
+
- Several voices in one model: balance batches (repeat small voices). A new voice added to a trained decoder reaches its own timbre after
|
| 111 |
+
~15 minutes of fine-tuning on one GPU; a new style vector alone keeps the old voice. One voice per model was 0.4-1.0 points clearer than
|
| 112 |
+
a shared 8-voice model on the same data: sharing is a trade.
|
| 113 |
+
- The decoder always learns from real Maya audio, never from a teacher's renders.
|
| 114 |
+
|
| 115 |
+
### 4c. Pitch, loudness and duration heads
|
| 116 |
+
- First the pitch/loudness branch plus a learned 128-number offset per voice (3,000 steps, lr 2e-4), then the duration head with the
|
| 117 |
+
offsets frozen (4,000 steps, lr 2e-4). Let the duration path see the offset detached: with one shared offset, a voice that needed a large
|
| 118 |
+
pitch shift read 19 % too fast.
|
| 119 |
+
- **Pace comes from the data.** The duration head learns only from takes inside the voice's natural-pace window (we centre it where the
|
| 120 |
+
voice's book-text pace maps to its natural pace on a test line). The model copies the pace of those takes: one window gave 204 wpm, a
|
| 121 |
+
slower one 194.
|
| 122 |
+
- **Never use a speed multiplier, a per-voice duration scale or stretched durations.** A model is clearest at its own natural pace:
|
| 123 |
+
speeding up or slowing down both cost clarity, and models trained on durations scaled x1.175 were less clear (6.3 %) than the same recipe
|
| 124 |
+
at the natural pace (5.5 %).
|
| 125 |
+
- **Train on whole passages, speak sentence by sentence.** Passage training moved the sentence-to-sentence melody a lot (pitch-step error
|
| 126 |
+
0.85 -> 0.55 semitones). Rendering whole lines at once didn't help.
|
| 127 |
+
|
| 128 |
+
### 4d. Creaky sentence ends
|
| 129 |
+
In our models creak at sentence ends comes from the predicted pitch dropping below the voicing floor, not from the decoder. A render-time
|
| 130 |
+
clamp fixes it without training: hold the last ~0.45 s of voiced pitch at or above max(85 Hz, sentence median - 6 semitones). On two deep
|
| 131 |
+
male voices creak went 63 -> 13 % and 76 -> 4 % of sentence ends, with the same clarity. Training the decoder only on clean endings, or a
|
| 132 |
+
lower pitch floor, did not help.
|
| 133 |
+
|
| 134 |
+
## 5. Distil to nano (`recipe/distil/`)
|
| 135 |
+
- **Text side** (~3 M parameters, ALBERT and predictor at about a third of the width): trained on text only to copy the teacher's per-sound
|
| 136 |
+
durations, pitch and loudness for every voice. Because the teacher is deterministic per voice, copying it doesn't flatten the melody.
|
| 137 |
+
98 % of sounds land within one frame of the teacher after ~2,000 steps.
|
| 138 |
+
- Teach the student's timing from each voice's pace head (4c), not the teacher's raw timing: two voices went from 8.1 to 5.2 % and from
|
| 139 |
+
11.1 to 9.4 % unclear, and each voice kept its own pace.
|
| 140 |
+
- **Sound side** (~4.1 M including its own small text encoder): trained on the real audio, to ~80k steps. A voice with only ~2 h of data
|
| 141 |
+
got rougher past ~70k steps.
|
| 142 |
+
- Distilled checkpoints swing in quality while the loss falls smoothly; pick by the bench, not by the last step.
|
| 143 |
+
- Result: 7.16 M parameters, 10.1 MB (int8 decoder, fp16 text side).
|
| 144 |
+
|
| 145 |
+
## 6. Export (`recipe/export/`)
|
| 146 |
+
- One ONNX graph (opset 17, batch 1) with a voice id input. Keep the sine source's phase path in float32 (some web builds can't cast to
|
| 147 |
+
float64) and store 2πk in float32: an fp16 constant put the top harmonics up to ~0.5 rad off.
|
| 148 |
+
- **Profile before optimising.** In nano the decoder is ~80 % of the time; in the 61 MB model the text side is ~58 %.
|
| 149 |
+
- **Two exact rewrites** (same maths, no retraining): the 64-harmonic sine sum in closed form, sin(Kt/2) sin((K+1)t/2) / sin(t/2), and the
|
| 150 |
+
six short-time Fourier transforms as one batched factorised DFT (600 = 25 x 24). On a Galaxy Tab S10 Lite (4 threads) nano went from
|
| 151 |
+
30x to 42x real time; the 8-voice bench didn't move (7.88 -> 7.85 % unclear).
|
| 152 |
+
- On nano, running 3 of the student ALBERT's 6 passes (no retraining) gave 46x real time and 0.10 s to the first sentence, with the bench
|
| 153 |
+
unchanged or slightly better (7.88 -> 7.62 %). On the 61 MB model, cutting passes without retraining broke clarity and melody.
|
| 154 |
+
- int8: an int8 decoder is the default file. Plain per-row int8 of a text side held every measure, but on onnxruntime 1.32 set
|
| 155 |
+
`session.disable_quant_qdq=1` or you lose the speed gain. Dynamic int8 on ALBERT/LSTMs didn't help.
|
| 156 |
+
- Splitting the first sentence at a comma halves the time to first audio but breaks the melody (the first half ends like a sentence).
|
| 157 |
+
|
| 158 |
+
## 7. Run it
|
| 159 |
+
- Python: `python/kale_tts.py` (onnxruntime + numpy, front end in-process). Node and browser: `js/kale-tts.mjs`. HTTP:
|
| 160 |
+
`server/server.mjs` (OpenAI-style `POST /v1/audio/speech`, WAV or streamed PCM). More engines and serving stacks: `runtimes/RUNTIMES.md`.
|
| 161 |
+
- CPU is the right target. One server core runs ~30 nano streams in real time. GPUs don't speed up a batch-1 graph this small (a T4 beat an
|
| 162 |
+
H100). vLLM and SGLang are built for autoregressive models and don't fit.
|
| 163 |
+
- Browser WebGPU: keep the six small LSTM layers on the CPU (`forceCpuNodeNames`; about 2x faster for nano), use nano's fp32 graph
|
| 164 |
+
(tiny: its int8 graph). `js/kale-tts.mjs` does both by default.
|
| 165 |
+
- Small serverless functions: set onnxruntime's intra-op threads to 1 on a 1-vCPU function (the default halves speed) and ship only your
|
| 166 |
+
platform's onnxruntime binaries.
|
| 167 |
+
- Mac: plain onnxruntime on the CPU (4 threads) beat CoreML by 2-4x.
|
| 168 |
+
|
| 169 |
+
Measured speed of the 8-voice nano file (16 Nov 2026):
|
| 170 |
+
| where | x real time | first audio |
|
| 171 |
+
|---|---|---|
|
| 172 |
+
| Galaxy Tab S10 Lite, 4 threads, release graph | 29-30x | 0.15-0.18 s |
|
| 173 |
+
| same, with the rewrites and 3 ALBERT passes (step 6) | 46x | 0.10 s |
|
| 174 |
+
| Linux server CPU, 4 threads | 37x (int8) / 46x (fp32) | 0.09 s |
|
| 175 |
+
| Mac laptop CPU (Apple M5 Max), 4 threads | 178x | 0.017 s |
|
| 176 |
+
A phone-sized browser window on a laptop is not a phone: one real phone ran an older model of ours ~3x slower than our laptop
|
| 177 |
+
phone-sized harness. Use real devices for phone numbers.
|
| 178 |
+
|
| 179 |
+
## 8. Measure
|
| 180 |
+
`recipe/bench/`: 192 lines, rendered sentence by sentence as an app would, 3 noise seeds (one render alone can be off by ~0.5
|
| 181 |
+
points), one loudness gain per model with zero clipped samples.
|
| 182 |
+
- **Unclear words**: each word's sounds checked against Maya's own takes of the same line. The score depends on the reference takes, so
|
| 183 |
+
score each voice against its own Maya takes and print Maya's own score next to it. On easier references a model looked 2.4 points
|
| 184 |
+
clearer than it was.
|
| 185 |
+
- **Weakest tenth**: mean UTMOS of the worst 10 % of lines. UTMOS likes large smooth decoders, sometimes more than the original audio.
|
| 186 |
+
- **Melody gap to Maya** (`melody_gap.py`): 0 = the voice's own Maya takes, lower is better; an averaged, flat melody can't score well.
|
| 187 |
+
We dropped "pitch-step error" as the headline: a flat average contour scored better than Maya herself.
|
| 188 |
+
- **Creak**: share of sentence ends with >= 100 ms of rough sound; compare with the voice's own Maya takes (some deep voices creak in the
|
| 189 |
+
source too).
|
| 190 |
+
- **Pace**: words / full clip seconds of one fixed test line at speed 1.0.
|
| 191 |
+
- Listen last, every time. Several of our models passed every metric and still sounded wrong.
|
| 192 |
+
|
| 193 |
+
8-voice nano (one 10 MB file), each voice against its own Maya takes, 3 seeds: unclear words 5.5-11.1 % in the first build and 4.4-9.4 %
|
| 194 |
+
after the timing fix of step 5 (the voices' own Maya takes: 3.2-6.3 %), weakest tenth 4.13-4.44, 173-195 wpm. Per-voice tables: MODEL_CARD.md.
|
| 195 |
+
|
| 196 |
+
## 9. What cost us the most time
|
| 197 |
+
- Rendering and filtering in batches instead of streaming; waiting for every voice before training.
|
| 198 |
+
- A creak detector that deleted male voices; checking only the last sentence end.
|
| 199 |
+
- Speed multipliers to hit a pace (the pace has to come from the data).
|
| 200 |
+
- Reading a melody number that rewards flat speech; comparing clarity on different reference sets.
|
| 201 |
+
- An American pronunciation front end on British voices (19.8 % unclear; a British front end plus a short fine-tune brought two British
|
| 202 |
+
voices from 8.4 to 7.7 % and 9.6 to 8.5 %).
|
| 203 |
+
- Many melody fixes on the pitch predictor (plain L1 fine-tunes, discriminators, contour codes, label heads, sampled pitch): none moved the
|
| 204 |
+
melody gap the way the text side's symbol set did.
|
| 205 |
+
|
| 206 |
+
## 10. Costs we measured
|
| 207 |
+
- Data for 8 voices (render + filter + strict checks): ~$200 on rented GPUs, most of it the filter. Whole night including training and
|
| 208 |
+
benches for both model sizes: ~$290.
|
| 209 |
+
- A two-voice run of a smaller recipe (render, filter, train one 21 MB model): ~$37.
|
| 210 |
+
|
| 211 |
+
## 11. Licences and credits
|
| 212 |
+
- Based on Maya (Maya-1, Maya Research, Apache-2.0); every training clip is synthetic, made with Maya-1 from a text description.
|
| 213 |
+
- Text side derived from Kokoro-82M (Apache-2.0, StyleTTS2 lineage, MIT). Front end: CMUdict (BSD-2 style notice), Britfone (MIT) for
|
| 214 |
+
British English, number/date rules adapted from dizione (Apache-2.0); no espeak, no GPL.
|
| 215 |
+
- Our weights and code: Apache-2.0. Our dataset: CC BY 4.0.
|
| 216 |
+
- All voices are synthetic. Don't use them to pass speech off as a real person's or as human-recorded.
|
LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
Apache License
|
| 3 |
+
Version 2.0, January 2004
|
| 4 |
+
http://www.apache.org/licenses/
|
| 5 |
+
|
| 6 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 7 |
+
|
| 8 |
+
1. Definitions.
|
| 9 |
+
|
| 10 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 11 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 12 |
+
|
| 13 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 14 |
+
the copyright owner that is granting the License.
|
| 15 |
+
|
| 16 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 17 |
+
other entities that control, are controlled by, or are under common
|
| 18 |
+
control with that entity. For the purposes of this definition,
|
| 19 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 20 |
+
direction or management of such entity, whether by contract or
|
| 21 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 22 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 23 |
+
|
| 24 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 25 |
+
exercising permissions granted by this License.
|
| 26 |
+
|
| 27 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 28 |
+
including but not limited to software source code, documentation
|
| 29 |
+
source, and configuration files.
|
| 30 |
+
|
| 31 |
+
"Object" form shall mean any form resulting from mechanical
|
| 32 |
+
transformation or translation of a Source form, including but
|
| 33 |
+
not limited to compiled object code, generated documentation,
|
| 34 |
+
and conversions to other media types.
|
| 35 |
+
|
| 36 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 37 |
+
Object form, made available under the License, as indicated by a
|
| 38 |
+
copyright notice that is included in or attached to the work
|
| 39 |
+
(an example is provided in the Appendix below).
|
| 40 |
+
|
| 41 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 42 |
+
form, that is based on (or derived from) the Work and for which the
|
| 43 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 44 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 45 |
+
of this License, Derivative Works shall not include works that remain
|
| 46 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 47 |
+
the Work and Derivative Works thereof.
|
| 48 |
+
|
| 49 |
+
"Contribution" shall mean any work of authorship, including
|
| 50 |
+
the original version of the Work and any modifications or additions
|
| 51 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 52 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 53 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 54 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 55 |
+
means any form of electronic, verbal, or written communication sent
|
| 56 |
+
to the Licensor or its representatives, including but not limited to
|
| 57 |
+
communication on electronic mailing lists, source code control systems,
|
| 58 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 59 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 60 |
+
excluding communication that is conspicuously marked or otherwise
|
| 61 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 62 |
+
|
| 63 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 64 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 65 |
+
subsequently incorporated within the Work.
|
| 66 |
+
|
| 67 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 68 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 69 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 70 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 71 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 72 |
+
Work and such Derivative Works in Source or Object form.
|
| 73 |
+
|
| 74 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 75 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 76 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 77 |
+
(except as stated in this section) patent license to make, have made,
|
| 78 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 79 |
+
where such license applies only to those patent claims licensable
|
| 80 |
+
by such Contributor that are necessarily infringed by their
|
| 81 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 82 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 83 |
+
institute patent litigation against any entity (including a
|
| 84 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 85 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 86 |
+
or contributory patent infringement, then any patent licenses
|
| 87 |
+
granted to You under this License for that Work shall terminate
|
| 88 |
+
as of the date such litigation is filed.
|
| 89 |
+
|
| 90 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 91 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 92 |
+
modifications, and in Source or Object form, provided that You
|
| 93 |
+
meet the following conditions:
|
| 94 |
+
|
| 95 |
+
(a) You must give any other recipients of the Work or
|
| 96 |
+
Derivative Works a copy of this License; and
|
| 97 |
+
|
| 98 |
+
(b) You must cause any modified files to carry prominent notices
|
| 99 |
+
stating that You changed the files; and
|
| 100 |
+
|
| 101 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 102 |
+
that You distribute, all copyright, patent, trademark, and
|
| 103 |
+
attribution notices from the Source form of the Work,
|
| 104 |
+
excluding those notices that do not pertain to any part of
|
| 105 |
+
the Derivative Works; and
|
| 106 |
+
|
| 107 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 108 |
+
distribution, then any Derivative Works that You distribute must
|
| 109 |
+
include a readable copy of the attribution notices contained
|
| 110 |
+
within such NOTICE file, excluding those notices that do not
|
| 111 |
+
pertain to any part of the Derivative Works, in at least one
|
| 112 |
+
of the following places: within a NOTICE text file distributed
|
| 113 |
+
as part of the Derivative Works; within the Source form or
|
| 114 |
+
documentation, if provided along with the Derivative Works; or,
|
| 115 |
+
within a display generated by the Derivative Works, if and
|
| 116 |
+
wherever such third-party notices normally appear. The contents
|
| 117 |
+
of the NOTICE file are for informational purposes only and
|
| 118 |
+
do not modify the License. You may add Your own attribution
|
| 119 |
+
notices within Derivative Works that You distribute, alongside
|
| 120 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 121 |
+
that such additional attribution notices cannot be construed
|
| 122 |
+
as modifying the License.
|
| 123 |
+
|
| 124 |
+
You may add Your own copyright statement to Your modifications and
|
| 125 |
+
may provide additional or different license terms and conditions
|
| 126 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 127 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 128 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 129 |
+
the conditions stated in this License.
|
| 130 |
+
|
| 131 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 132 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 133 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 134 |
+
this License, without any additional terms or conditions.
|
| 135 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 136 |
+
the terms of any separate license agreement you may have executed
|
| 137 |
+
with Licensor regarding such Contributions.
|
| 138 |
+
|
| 139 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 140 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 141 |
+
except as required for reasonable and customary use in describing the
|
| 142 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 143 |
+
|
| 144 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 145 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 146 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 147 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 148 |
+
implied, including, without limitation, any warranties or conditions
|
| 149 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 150 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 151 |
+
appropriateness of using or redistributing the Work and assume any
|
| 152 |
+
risks associated with Your exercise of permissions under this License.
|
| 153 |
+
|
| 154 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 155 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 156 |
+
unless required by applicable law (such as deliberate and grossly
|
| 157 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 158 |
+
liable to You for damages, including any direct, indirect, special,
|
| 159 |
+
incidental, or consequential damages of any character arising as a
|
| 160 |
+
result of this License or out of the use or inability to use the
|
| 161 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 162 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 163 |
+
other commercial damages or losses), even if such Contributor
|
| 164 |
+
has been advised of the possibility of such damages.
|
| 165 |
+
|
| 166 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 167 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 168 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 169 |
+
or other liability obligations and/or rights consistent with this
|
| 170 |
+
License. However, in accepting such obligations, You may act only
|
| 171 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 172 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 173 |
+
defend, and hold each Contributor harmless for any liability
|
| 174 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 175 |
+
of your accepting any such warranty or additional liability.
|
| 176 |
+
|
| 177 |
+
END OF TERMS AND CONDITIONS
|
| 178 |
+
|
| 179 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 180 |
+
|
| 181 |
+
To apply the Apache License to your work, attach the following
|
| 182 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 183 |
+
replaced with your own identifying information. (Don't include
|
| 184 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 185 |
+
comment syntax for the file format. We also recommend that a
|
| 186 |
+
file or class name and description of purpose be included on the
|
| 187 |
+
same "printed page" as the copyright notice for easier
|
| 188 |
+
identification within third-party archives.
|
| 189 |
+
|
| 190 |
+
Copyright [yyyy] [name of copyright owner]
|
| 191 |
+
|
| 192 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 193 |
+
you may not use this file except in compliance with the License.
|
| 194 |
+
You may obtain a copy of the License at
|
| 195 |
+
|
| 196 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 197 |
+
|
| 198 |
+
Unless required by applicable law or agreed to in writing, software
|
| 199 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 200 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 201 |
+
See the License for the specific language governing permissions and
|
| 202 |
+
limitations under the License.
|
README.md
ADDED
|
@@ -0,0 +1,411 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
# DRAFT, NOT PUBLISHED. Credit: based on Maya (Maya-1).
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
language: [en]
|
| 5 |
+
pipeline_tag: text-to-speech
|
| 6 |
+
library_name: onnx
|
| 7 |
+
tags: [text-to-speech, tts, small, cpu, on-device, synthetic-voices, based-on-maya]
|
| 8 |
+
base_model: KaleComputer/kale-tts-1-base
|
| 9 |
+
base_model_relation: finetune
|
| 10 |
+
datasets: [KaleComputer/kale-tts-1-data]
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+

|
| 14 |
+
|
| 15 |
+
# kale-tts-1-tiny
|
| 16 |
+
|
| 17 |
+
kale-tts-1-tiny is a small English text-to-speech model with 10 voices designed with [Maya-1](https://huggingface.co/maya-research/maya1), that runs on CPU or GPU on low-end devices. It stays as close as possible to Maya-1's melody, which already sounds great, while running on weak hardware.
|
| 18 |
+
|
| 19 |
+
| measure | value |
|
| 20 |
+
|---|---|
|
| 21 |
+
| size | 79.9 MB on the CPU (int8, `model.onnx`); 183.2 MB for WebGPU in the browser (float32, `model.fp32.onnx`) |
|
| 22 |
+
| parameters | 45.7M (16.8M of them the frozen Ettin word encoder) |
|
| 23 |
+
| unclear words | +1.4 points vs Maya-1's own recordings (Maya-1: 5.82 %) |
|
| 24 |
+
| melody gap | +7.48 points vs Maya-1's own recordings (Maya-1: 0) |
|
| 25 |
+
| speed, Samsung Galaxy Tab S10 Lite CPU | 24x real time, first sentence after 0.16 s |
|
| 26 |
+
| speed, Mac browser | 87x (WebGPU), 48x (WASM) |
|
| 27 |
+
|
| 28 |
+
Unclear words: a speech recognizer listens word by word, and "unclear" is the share of words it isn't sure about; Maya-1's own recordings
|
| 29 |
+
score 5.82 % on the same lines. Melody gap: how far the voice's pitch melody is from Maya-1's own recordings of the same lines, in
|
| 30 |
+
percentile points; Maya-1 scores 0. Lower is better for both.
|
| 31 |
+
|
| 32 |
+
Want something smaller and faster, with slightly less quality? Try [kale-tts-1-nano](https://huggingface.co/KaleComputer/kale-tts-1-nano).
|
| 33 |
+
|
| 34 |
+
Trained on [kale-tts-1-data](https://huggingface.co/datasets/KaleComputer/kale-tts-1-data): 204.7 hours (99,783 takes) of the 10 voices' speech with its text, CC BY 4.0, open for anyone to train their own.
|
| 35 |
+
|
| 36 |
+
## Voices
|
| 37 |
+
|
| 38 |
+
| name | voice | pronunciation |
|
| 39 |
+
|---|---|---|
|
| 40 |
+
| Kenzie | esports hype woman | US English |
|
| 41 |
+
| Simone | deep and confident woman | US English |
|
| 42 |
+
| Amy | crisp news-style woman | British English |
|
| 43 |
+
| Frankie | hard-boiled detective's partner | US English |
|
| 44 |
+
| Darlene | rough low-voiced old trucker woman | US English |
|
| 45 |
+
| Owen | bright young host | US English |
|
| 46 |
+
| Toby | mischievous prankster | US English |
|
| 47 |
+
| Jack | crisp news-style man | British English |
|
| 48 |
+
| Earl | African American jazz granddad | US English |
|
| 49 |
+
| Magnus | deep dramatic trailer narrator | US English |
|
| 50 |
+
|
| 51 |
+
Every voice was designed from a one-line text description; none is a real person.
|
| 52 |
+
|
| 53 |
+
## Listen
|
| 54 |
+
|
| 55 |
+
[](https://huggingface.co/spaces/KaleComputer/kale-tts-1)
|
| 56 |
+
|
| 57 |
+
Every voice, in your browser: [the kale-tts-1 demo](https://huggingface.co/spaces/KaleComputer/kale-tts-1).
|
| 58 |
+
|
| 59 |
+
## Why we made it
|
| 60 |
+
|
| 61 |
+
We build a privacy-focused computer for kids. Our goal is to run all the AI locally on the device, so privacy is as high as it can be.
|
| 62 |
+
Audio models were the quick first win, because they're easy to do with AI right now.
|
| 63 |
+
|
| 64 |
+
We made our own voice for Kale (Hazel), and we're keeping that one. But we share the whole concept, so you can recreate any voice from [Maya-1](https://huggingface.co/maya-research/maya1). And here are 10 voices to try right away.
|
| 65 |
+
|
| 66 |
+
## How it works
|
| 67 |
+
|
| 68 |
+
### What it's made of
|
| 69 |
+
|
| 70 |
+

|
| 71 |
+
|
| 72 |
+
45.7M parameters in one 79.9 MB file (the CPU file; 183.2 MB for WebGPU): the dictionary in front, the Ettin word reader (16.8M, frozen), the part that reads the text and plans timing and melody (24.8M: a 3.0M phoneme reader + the 21.8M planner of kale-tts-1-base, frozen), a sound generator (4.1M), and a voice pack per voice.
|
| 73 |
+
|
| 74 |
+
### How it was made
|
| 75 |
+
|
| 76 |
+

|
| 77 |
+
|
| 78 |
+
1. **Maya-1** designs the 10 voices from a line of text and records their training audio: 204.7 hours.
|
| 79 |
+
2. **[kale-tts-1-base](https://huggingface.co/KaleComputer/kale-tts-1-base)**, our Kokoro-82M fine-tuned on our 10 voices (made with Maya-1), is the teacher: its timing-and-melody planner taught this model; it's too big and slow for the tablet. kale-tts-1-tiny is distilled from it; the teacher is its own model repo.
|
| 80 |
+
3. **kale-tts-1-tiny** keeps the timing-and-melody planner of kale-tts-1-base (21.8M, frozen) and puts a small phoneme reader (3.0M) and the frozen Ettin word reader (16.8M), which understands whole sentences, in front of it. The part that makes the sound (4.1M, a small harmonic-plus-noise generator) learns straight from Maya-1's audio. kale-tts-1-nano is a smaller student distilled from the same teacher.
|
| 81 |
+
4. In front of it all, **the dictionary** turns words into sounds; every word is checked.
|
| 82 |
+
|
| 83 |
+
No flow matching and no diffusion anywhere: one pass per sentence.
|
| 84 |
+
|
| 85 |
+
### Turns words into sounds
|
| 86 |
+

|
| 87 |
+
|
| 88 |
+
Tech terms first ("Node.js" -> "Node J S"), then numbers, dates, money and units as words (dizione rules), then every word through a
|
| 89 |
+
CMUdict-based dictionary, a hand-checked override list and a small guesser for unknown words. No espeak. Files: `frontend/`.
|
| 90 |
+
|
| 91 |
+
### A checked dictionary
|
| 92 |
+
Small TTS models live or die by their front end: the wrong sounds make the best voice say the wrong word. We checked every word the front
|
| 93 |
+
end can meet (334,000 words, American and British) and fixed 3,800+ readings in `frontend/words/override.public.tsv`. Example: "details"
|
| 94 |
+
came out of the base dictionary as dih-TAILS (`dɪtˈeɪlz`); one line in the override list makes it DEE-tails (`dˈiːtˌeɪlz`).
|
| 95 |
+
|
| 96 |
+
**Add a word:** one line in `frontend/words/override.public.tsv` (British: `frontend/words/en-gb/override.public.tsv`): the word in
|
| 97 |
+
lower case, a tab, its IPA (stress mark right before the vowel). It wins over the dictionary and the guesser. Prompt for a coding agent:
|
| 98 |
+
```
|
| 99 |
+
In this repository, add the word "<word>" to frontend/words/override.public.tsv with the pronunciation <IPA> (one line: word, a tab,
|
| 100 |
+
the IPA in the same style as the other lines). Check that the word is not a person's name and is not offensive; if it is, stop. Run the
|
| 101 |
+
front end on a sentence with the word (python/kale_tts.py: QuickJSFrontEnd) and confirm the new IPA. Then render it with kale-tts-1-tiny and listen.
|
| 102 |
+
```
|
| 103 |
+
|
| 104 |
+
### Reads the text, plans timing and melody
|
| 105 |
+
|
| 106 |
+
A small phoneme reader (3.0M) and the frozen Ettin word reader (jhu-clsp/ettin-encoder-17m, MIT, 16.8M, inside the graph), which understands whole sentences, feed the teacher's own timing-and-melody planner (21.8M, kept frozen). The word inputs (`ettin_ids`, `ettin_mask`, `wavg`, `widx`) come from `frontend/ettin.js` + `ettin-tokenizer.json`.
|
| 107 |
+
|
| 108 |
+
### Makes the sound
|
| 109 |
+
|
| 110 |
+
A small generator (4.1M): a harmonic source plus noise through a learned filter, then an inverse STFT to 24 kHz. No separate vocoder, no flow matching: one pass per sentence. At the end of a sentence a per-voice pitch floor keeps the last words from creaking.
|
| 111 |
+
|
| 112 |
+
### Voices
|
| 113 |
+

|
| 114 |
+
|
| 115 |
+
Each voice starts as a one-line description given to Maya-1. Maya-1 reads thousands of sentences in that voice; a filter keeps the takes
|
| 116 |
+
that read back right, match the voice and end cleanly. Each voice ships as a style table and a 16-number sound row (`voices/`).
|
| 117 |
+
|
| 118 |
+
### Training data
|
| 119 |
+

|
| 120 |
+
|
| 121 |
+
99,783 original Maya-1 takes, 204.7 hours, 10 voices, texts from public-domain books: [kale-tts-1-data](https://huggingface.co/datasets/KaleComputer/kale-tts-1-data) (CC BY 4.0).
|
| 122 |
+
About 25 hours of clean takes per voice is where clarity levels off; 5 hours already sounds right but is less clear.
|
| 123 |
+
|
| 124 |
+
### How we picked the base model
|
| 125 |
+

|
| 126 |
+
|
| 127 |
+
We tried open-weight models on the same 192 test lines against Maya-1's own recordings. Fine-tuned on Maya-1's audio, Kokoro-82M was the
|
| 128 |
+
clearest and the closest to Maya-1's melody, but it ran at about real time on the tablet, far too slow, so it became the teacher:
|
| 129 |
+
[kale-tts-1-base](https://huggingface.co/KaleComputer/kale-tts-1-base). The published kale-tts-1-base keeps that fine-tune's text side and planner with stock Kokoro-82M's
|
| 130 |
+
sound decoder; on the same bench it is less clear (+3.9 points) than tiny and nano.
|
| 131 |
+
|
| 132 |
+
### How we measure
|
| 133 |
+

|
| 134 |
+
|
| 135 |
+
192 English lines (stories, explanations, numbers, questions), all 10 voices, sentence by sentence as an app speaks; each voice against
|
| 136 |
+
Maya-1's own recordings of the same lines. Unclear words: word spans from CTC forced alignment (wav2vec2-large-960h-lv60-self); kale-tts-1-tiny
|
| 137 |
+
reads 7.23 % unclear, Maya-1's recordings 5.82 %. Per voice: `results/bench/bench-10voices.json`.
|
| 138 |
+
Export check: every release file against a float32 build of the same weights on 200 sentences; the same length on each (int8: at most one
|
| 139 |
+
sentence one frame off) and a log-mel distance of at most 0.20. tiny: the same length on all 200 sentences, log-mel distance 0.077; Whisper word errors 0.49 % on the 10-voice bench.
|
| 140 |
+
|
| 141 |
+
### Extend it
|
| 142 |
+

|
| 143 |
+
|
| 144 |
+
- **A word:** one line in the override list (above).
|
| 145 |
+
- **A voice:** a one-line description, a few thousand Maya-1 takes (`recipe/render/`, `recipe/filter/`), then teacher, heads and a new sound row (`recipe/train/`, `recipe/export/`).
|
| 146 |
+
- **A language:** its own dictionary, guesser and number rules, takes in the same voices, then the text reader and planner fine-tuned on both languages.
|
| 147 |
+
|
| 148 |
+
## Where it runs
|
| 149 |
+
|
| 150 |
+
| where | runs | speed and notes |
|
| 151 |
+
|---|---|---|
|
| 152 |
+
| Browser, WebGPU | yes | 87x; downloads the 183.2 MB float32 file (onnxruntime-web 1.31 or newer) |
|
| 153 |
+
| Browser, WASM | yes | 48x with 4 threads (the 79.9 MB CPU file; threads need COOP/COEP headers) |
|
| 154 |
+
| Android (onnxruntime) | yes | 24x on the Galaxy Tab S10 Lite CPU, first sentence after 0.16 s |
|
| 155 |
+
| iOS | not tested | onnxruntime runs there; we have no device numbers |
|
| 156 |
+
| Python | yes | 114x (`python/kale_tts.py`; needs `pip install quickjs`) |
|
| 157 |
+
| Node.js | yes | 117x (`js/kale-tts.mjs`) |
|
| 158 |
+
| HTTP server (`server/server.mjs`) | yes | 82x for whole lines, text in, WAV out (one process; WAV or streamed) |
|
| 159 |
+
| transformers.js | yes | in Node, with our text-prep helper for the inputs (see Use it) |
|
| 160 |
+
| sherpa-onnx, kokoro-onnx, plain C / Go / Rust / Swift | no | these pass phoneme ids only; tiny also needs word inputs from its Ettin encoder, which our JavaScript and Python code builds from the text |
|
| 161 |
+
|
| 162 |
+
Speed = times faster than real time, median over 70 test lines in Kenzie's voice (18 Nov): the model one sentence at a time; the server row whole lines, text in, WAV out. Machines: Apple MacBook Pro, M5 Max (18 CPU cores, 128 GB RAM) for the browser, Python, Node and server rows;
|
| 163 |
+
Samsung Galaxy Tab S10 Lite (Exynos 1380, 8 CPU cores: 4 × Cortex-A78 + 4 × Cortex-A55) for Android (10x on 1 thread). Speed was measured on a 73.9 MB variant of this graph (its phoneme encoder in fp16); the 79.9 MB file keeps that encoder in float32 and may be slightly slower.
|
| 164 |
+
|
| 165 |
+
## Use it
|
| 166 |
+
|
| 167 |
+
**transformers.js**
|
| 168 |
+
|
| 169 |
+
```bash
|
| 170 |
+
npm i @huggingface/transformers
|
| 171 |
+
npm pkg set type=module
|
| 172 |
+
|
| 173 |
+
# our text-prep helper: the js/ and frontend/ folders of this repo
|
| 174 |
+
pip install -U huggingface_hub
|
| 175 |
+
hf download KaleComputer/kale-tts-1-tiny --local-dir . --include "js/*" --include "frontend/*"
|
| 176 |
+
```
|
| 177 |
+
|
| 178 |
+
Save as `tts.mjs`, then run `node tts.mjs`:
|
| 179 |
+
|
| 180 |
+
```js
|
| 181 |
+
import { writeFileSync } from "node:fs";
|
| 182 |
+
import { StyleTextToSpeech2Model, Tensor } from "@huggingface/transformers";
|
| 183 |
+
import { KaleTTS, toWav } from "./js/kale-tts.mjs";
|
| 184 |
+
|
| 185 |
+
const model = await StyleTextToSpeech2Model.from_pretrained("KaleComputer/kale-tts-1-tiny", { subfolder: "", dtype: "fp32" });
|
| 186 |
+
|
| 187 |
+
// text -> the model's inputs, sentence by sentence
|
| 188 |
+
const prep = await KaleTTS.prepare("https://huggingface.co/KaleComputer/kale-tts-1-tiny/resolve/main/");
|
| 189 |
+
|
| 190 |
+
const parts = [];
|
| 191 |
+
for await (const { inputs } of prep.inputs("Hello there! It is 9:30 on March 3.", { voice: "kenzie" })) {
|
| 192 |
+
const feeds = {};
|
| 193 |
+
for (const [name, t] of Object.entries(inputs)) feeds[name] = new Tensor(t.type, t.data, t.dims);
|
| 194 |
+
|
| 195 |
+
// waveform.data: Float32Array, 24 kHz
|
| 196 |
+
const { waveform } = await model(feeds);
|
| 197 |
+
parts.push(waveform.data);
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
const audio = new Float32Array(parts.reduce((n, p) => n + p.length, 0));
|
| 201 |
+
let at = 0;
|
| 202 |
+
for (const p of parts) { audio.set(p, at); at += p.length; }
|
| 203 |
+
writeFileSync("hello.wav", Buffer.from(toWav(audio, 24000)));
|
| 204 |
+
```
|
| 205 |
+
|
| 206 |
+
`KaleTTS.prepare()` is our small text-prep helper: it turns text into this model's inputs (numbers and dates as words, the checked
|
| 207 |
+
dictionary, the voice's style and voice inputs, and for tiny the Ettin word inputs). transformers.js has no tokenizer for these inputs,
|
| 208 |
+
so the helper builds them and transformers.js runs the model.
|
| 209 |
+
|
| 210 |
+
On WebGPU (transformers.js 4.3 or newer), load the float32 file and keep the six small LSTM layers on the CPU for full speed, the same
|
| 211 |
+
settings our runtime uses:
|
| 212 |
+
|
| 213 |
+
```js
|
| 214 |
+
const LSTM_NODES = ["lstms.0", "lstms.2", "lstms.4", "lstm", "shared", "lstm_1"].flatMap((n) => [`/g/${n}/LSTM`, `/${n}/LSTM`]);
|
| 215 |
+
|
| 216 |
+
const model = await StyleTextToSpeech2Model.from_pretrained("KaleComputer/kale-tts-1-tiny", {
|
| 217 |
+
subfolder: "",
|
| 218 |
+
dtype: "fp32",
|
| 219 |
+
model_file_name: "model.fp32",
|
| 220 |
+
device: "webgpu",
|
| 221 |
+
session_options: { executionProviders: [{ name: "webgpu", forceCpuNodeNames: LSTM_NODES }] },
|
| 222 |
+
});
|
| 223 |
+
```
|
| 224 |
+
|
| 225 |
+
**This is temporary.**
|
| 226 |
+
|
| 227 |
+
- CPU and WASM: Transformers.js is 11–19 % slower than our own runtime today, because it pins an older onnxruntime. The gap closes by
|
| 228 |
+
itself when [transformers.js PR #1879](https://github.com/huggingface/transformers.js/pull/1879) (onnxruntime 1.31.1) is merged;
|
| 229 |
+
nothing changes in your code.
|
| 230 |
+
- WebGPU: the two extra lines (`LSTM_NODES` and `session_options`) keep six small LSTM layers on the CPU. They stay until an
|
| 231 |
+
onnxruntime release with the LSTM fix ships in Transformers.js; then you can remove them.
|
| 232 |
+
|
| 233 |
+
**Without transformers.js: our runtime**
|
| 234 |
+
|
| 235 |
+
Download the model with our runtime. It turns any text into speech, numbers, dates and tech terms included:
|
| 236 |
+
|
| 237 |
+
```bash
|
| 238 |
+
# the hf command comes with huggingface_hub
|
| 239 |
+
pip install -U huggingface_hub
|
| 240 |
+
|
| 241 |
+
# only the files the runtime needs
|
| 242 |
+
hf download KaleComputer/kale-tts-1-tiny --local-dir kale-tts-1-tiny \
|
| 243 |
+
--include "model.onnx" --include "*tokenizer.json" --include "voices.json" --include "config.json" \
|
| 244 |
+
--include "voices/*" --include "js/*" --include "frontend/*" --include "python/*" --include "server/*"
|
| 245 |
+
|
| 246 |
+
cd kale-tts-1-tiny
|
| 247 |
+
```
|
| 248 |
+
|
| 249 |
+
**Node.js**
|
| 250 |
+
|
| 251 |
+
```bash
|
| 252 |
+
npm i onnxruntime-node
|
| 253 |
+
npm pkg set type=module
|
| 254 |
+
```
|
| 255 |
+
|
| 256 |
+
Save as `hello.mjs`, then run `node hello.mjs`:
|
| 257 |
+
|
| 258 |
+
```js
|
| 259 |
+
import { writeFileSync } from "node:fs";
|
| 260 |
+
import { KaleTTS, toWav } from "./js/kale-tts.mjs";
|
| 261 |
+
|
| 262 |
+
const tts = await KaleTTS.load("./");
|
| 263 |
+
|
| 264 |
+
// audio: Float32Array, 24 kHz
|
| 265 |
+
const { audio } = await tts.speak("Hello there! It is 9:30 on March 3.", { voice: "kenzie" });
|
| 266 |
+
writeFileSync("hello.wav", Buffer.from(toWav(audio, 24000)));
|
| 267 |
+
|
| 268 |
+
// for long text, sentence by sentence:
|
| 269 |
+
// for await (const { audio } of tts.stream(longText, { voice: "amy" })) play(audio);
|
| 270 |
+
```
|
| 271 |
+
|
| 272 |
+
**Python**
|
| 273 |
+
|
| 274 |
+
```bash
|
| 275 |
+
pip install onnxruntime numpy quickjs soundfile
|
| 276 |
+
```
|
| 277 |
+
|
| 278 |
+
Save as `hello.py` in the same folder, then run `python hello.py`:
|
| 279 |
+
|
| 280 |
+
```python
|
| 281 |
+
import sys
|
| 282 |
+
sys.path.insert(0, "python")
|
| 283 |
+
|
| 284 |
+
import soundfile as sf
|
| 285 |
+
from kale_tts import KaleTTS
|
| 286 |
+
|
| 287 |
+
tts = KaleTTS(".")
|
| 288 |
+
|
| 289 |
+
# float32 audio, 24 kHz
|
| 290 |
+
audio = tts.speak("Hello there!", voice="amy")
|
| 291 |
+
sf.write("hello.wav", audio, 24000)
|
| 292 |
+
```
|
| 293 |
+
|
| 294 |
+
**HTTP server**
|
| 295 |
+
|
| 296 |
+
Run it locally and call it from any language or app over HTTP (an OpenAI-shaped `POST /v1/audio/speech`, WAV or streamed PCM):
|
| 297 |
+
|
| 298 |
+
```bash
|
| 299 |
+
npm i onnxruntime-node
|
| 300 |
+
|
| 301 |
+
# without a token it only listens on 127.0.0.1
|
| 302 |
+
TTS_API_TOKEN=choose-a-secret-of-20-characters PORT=8000 node server/server.mjs
|
| 303 |
+
```
|
| 304 |
+
|
| 305 |
+
```bash
|
| 306 |
+
curl -s http://127.0.0.1:8000/v1/audio/speech \
|
| 307 |
+
-H "Authorization: Bearer choose-a-secret-of-20-characters" \
|
| 308 |
+
-d '{"model": "kale-tts-1-tiny", "input": "Hello there!", "voice": "kenzie"}' \
|
| 309 |
+
-o hello.wav
|
| 310 |
+
```
|
| 311 |
+
|
| 312 |
+
You pass the voice by its name.
|
| 313 |
+
|
| 314 |
+
## How we made it
|
| 315 |
+
|
| 316 |
+
Research agents ran the experiments, on Claude Opus 5.5 and Claude Fable 5.2. We told them what to find out, and an automation checked
|
| 317 |
+
every 60 minutes whether any agent was stuck and got it moving again.
|
| 318 |
+
|
| 319 |
+
What we tried, one line each:
|
| 320 |
+
|
| 321 |
+
**Teacher and data**
|
| 322 |
+
- Maya-1 voice designer + SNAC codec, served on vLLM: worked. It made all the training audio, about 12-14x faster than plain generation.
|
| 323 |
+
- Maya-1 itself on the device, with speculative decoding: didn't work, about 0.1x real time.
|
| 324 |
+
- Kokoro-82M fine-tuned StyleTTS2-style (kikiri-tts) as the teacher: worked. The clearest in our model comparison (before its decoder swap), but about 1x real time on the tablet.
|
| 325 |
+
- Training on whole multi-sentence passages, speaking sentence by sentence: worked, the main melody lever.
|
| 326 |
+
- More data (a 114 h multi-voice pretrain, more hours per voice): didn't help much; about 25 h per voice is enough.
|
| 327 |
+
- Speed multipliers and stretched durations: didn't work, less clear. Pace now comes from per-voice duration heads.
|
| 328 |
+
|
| 329 |
+
**Reading the text, planning, the dictionary**
|
| 330 |
+
- Our own ~8 M model from scratch: misread too many words. Its shape became nano's student.
|
| 331 |
+
- A small student that reads the text and plans timing, pitch and loudness, distilled from the teacher, plus a sound generator trained on real audio: worked, that's kale-tts-1-nano.
|
| 332 |
+
- Ettin-encoder-17m word features instead of ALBERT: worked on tiny (about 1.6x faster on the tablet, same clarity); on nano bigger, not faster.
|
| 333 |
+
- Fewer ALBERT passes, dynamic int8 ALBERT: didn't work, broke the melody or failed to load on Android.
|
| 334 |
+
- Pitch fixes (pitch LoRA, contour discriminator, flow-matching pitch sampler, prosody label heads, a GRPO duration reward): no melody gain; GRPO learned to talk faster.
|
| 335 |
+
- misaki dictionaries: best melody, but ruled out (they derive from GPL espeak output). CMUdict + our own guesser recovers about half of it.
|
| 336 |
+
- A British front end (CMUdict rules + Britfone): only works with British-trained weights, so it ships off.
|
| 337 |
+
|
| 338 |
+
**Making the sound**
|
| 339 |
+
- Matcha-TTS + Vocos: larger, slower, dull above about 5 kHz.
|
| 340 |
+
- Other vocoders and codec adapters (WaveNeXt, BigVGAN, codec adapters): no gain on the device, much slower, or worse sound.
|
| 341 |
+
- DiT flow-matching decoder, REPA, one-step decoders, an adversarial mel post-filter: too slow on the tablet or no gain by ear.
|
| 342 |
+
- A small autoregressive codec-token TTS: about 1.3-1.6x real time, too slow.
|
| 343 |
+
- A source-filter decoder (sine bank + shaped noise + one inverse STFT, no separate vocoder): worked, it ships in both models.
|
| 344 |
+
- A per-voice pitch floor at sentence ends: worked, it removed most end-of-sentence creak.
|
| 345 |
+
|
| 346 |
+
**Export**
|
| 347 |
+
- ONNX with int8 weights where safe, float32 timing and phase paths, the LSTMs on the CPU in browsers: worked. int8 on the timing path changed
|
| 348 |
+
durations; CoreML and GPU serving didn't help.
|
| 349 |
+
|
| 350 |
+
**Earlier directions: voices and data**
|
| 351 |
+
- VoxCPM2 and other voice-design models (Qwen3-TTS VoiceDesign, MOSS-VoiceGenerator, Ming-TTS, Parler-TTS) as the voice maker: dropped. Their takes sounded flatter, and the Maya-1 designs won the listening rounds.
|
| 352 |
+
- Moods and sound tags from Maya-1 (calm, whisper, laugh, sigh) as extra speaker ids: worked at no speed cost, but Maya-1 often skipped the tag sounds. kale-tts-1 has one style per voice and no tag tokens.
|
| 353 |
+
|
| 354 |
+
**Earlier directions: Matcha-TTS fine-tuning**
|
| 355 |
+
- Our own Matcha-TTS base trained from scratch on LJSpeech: worked, as good as the original.
|
| 356 |
+
- Per-voice adapters: LoRA rank 32 came close to a full fine-tune, rank 8 was worse; a decoder-only fine-tune was far less clear (13.3 % vs 4.8 % unclear words).
|
| 357 |
+
- Sampler settings (2-10 decoder steps, solvers, noise, guidance, checkpoint averaging): no gain; 2 steps sounded like 3.
|
| 358 |
+
|
| 359 |
+
**Earlier directions: other models as the on-device voice**
|
| 360 |
+
- Kokoro-82M on the tablet, full and pruned to 37-44 M: too slow (about 1x and 6x real time), so it became the teacher only.
|
| 361 |
+
- Piper (VITS) medium fine-tunes: as fast as Matcha but scored lower; the high size was too slow.
|
| 362 |
+
- Supertonic 3: 2.4x real time on the tablet, and its OpenRAIL-M licence also covers models trained on its output.
|
| 363 |
+
- Kitten TTS nano with a searched style: no closer to the target voice than its preset, 2.5x on the tablet.
|
| 364 |
+
- Zonos 3 Mini: below real time on the tablet and a 1.1 GB download.
|
| 365 |
+
- Voice cloning (a 12 M ZipVoice from scratch, Matcha-P with a voice prompt, the 123 M ZipVoice): dropped for a fixed voice set; ZipVoice cloned well but was 15-25x too slow on the tablet.
|
| 366 |
+
- An MB-iSTFT-VITS-style end-to-end model (8.2 M, 4.7 M): very fast, but quality stalled below the bar.
|
| 367 |
+
- Mach-Boom (Phonon 31M): fast, but no published audio encoder, so it can't learn a new voice.
|
| 368 |
+
- Not tested because their licences don't allow commercial use: F5-TTS, XTTS-v2, Fish Speech, Spark-TTS, MaskGCT.
|
| 369 |
+
|
| 370 |
+
**Earlier directions: prosody, speed and serving**
|
| 371 |
+
- A sampled prosody plan (flow-matching durations, pitch, loudness): closest pauses, but less clear (6.7-7.8 % unclear words).
|
| 372 |
+
- A sentence-level delivery latent with context from the previous sentence: no melody gain.
|
| 373 |
+
- A distilled 5-6 M Vocos vocoder: about 2x faster, but below the full vocoder.
|
| 374 |
+
- The tablet GPU (our own WebGPU kernels) and XNNPACK: both slower than plain onnxruntime on 4 CPU cores.
|
| 375 |
+
- Streaming part of a sentence: left seams on our decoder and hurt the melody; whole sentences are already fast.
|
| 376 |
+
- vLLM / SGLang serving and CoreML: don't fit a one-pass model, or 2-4x slower than the CPU.
|
| 377 |
+
|
| 378 |
+
**Earlier directions: yardsticks and other languages**
|
| 379 |
+
- kitten-tts-2 as a yardstick: kitten mini matched our small model on clarity but was 20x slower on the tablet.
|
| 380 |
+
- A German teacher scout (Qwen3-TTS, Chatterbox, VoxCPM2, CosyVoice3, MOSS-TTS): Qwen3-TTS read best; no German model trained yet.
|
| 381 |
+
|
| 382 |
+
## Make it faster or better
|
| 383 |
+
- **WebGPU:** keep the six small LSTM layers on the CPU (`forceCpuNodeNames`; our JS API does it by default): about 2.2x faster on onnxruntime-web 1.27 and newer (29x -> 63x through transformers.js, 18 Nov).
|
| 384 |
+
- **Pick the file per backend:** the int8 `model.onnx` on CPU and WASM, `model.fp32.onnx` on WebGPU.
|
| 385 |
+
- **Threads:** 4 threads on a phone or tablet CPU; on a server 1 thread per process and one process per core.
|
| 386 |
+
- **Stream sentence by sentence:** the first sentence plays while the rest renders.
|
| 387 |
+
- **A smaller text reader:** most of tiny's extra time is the Ettin word reader; nano's own small reader is about 2x faster, with a melody further from Maya-1's.
|
| 388 |
+
- **Train it better:** more clean recordings per voice (about 25 h each is where clarity levels off) and a cleaner teacher help more than a bigger model.
|
| 389 |
+
|
| 390 |
+
## Limits
|
| 391 |
+
- Kenzie's melody is the furthest from her Maya-1 recordings (melody gap 9.19, against 7.48 on average).
|
| 392 |
+
- The two British voices are the least clear: Amy 9.0 %, Jack 9.1 % unclear (their Maya-1 recordings: 5.8 / 6.0 %).
|
| 393 |
+
- English only. Rare names and heavy numbers can be misread; the guesser for unknown words is right on about two thirds of them.
|
| 394 |
+
- Needs our text-prep code (JavaScript or Python) for the Ettin word inputs; tools that pass phoneme ids only can run nano instead.
|
| 395 |
+
- Not for impersonating real people or passing the output off as human speech.
|
| 396 |
+
|
| 397 |
+
## Files
|
| 398 |
+
`model.onnx` (79.90 MB, int8 / fp16 weights where safe, phoneme encoder and durations float32), `model.fp32.onnx` (183.25 MB, float32, for WebGPU), `voices/` + `voices.json`, `tokenizer.json`, `ettin-tokenizer.json` (MIT). Inputs: `input_ids`, `style`, `speed`, `ettin_ids`, `ettin_mask`, `wavg`, `widx`, then the voice inputs listed in `voices.json`. The training recipe is in `recipe/`.
|
| 399 |
+
|
| 400 |
+
## Licence and credits
|
| 401 |
+
Weights and code Apache-2.0; dataset CC BY 4.0.
|
| 402 |
+
|
| 403 |
+
AI-generated speech: everything this model says is synthetic speech made by an AI model, in voices that belong to no real person. Tell
|
| 404 |
+
listeners it is AI-generated, never present it as a human recording, and never use it to imitate a real person.
|
| 405 |
+
|
| 406 |
+
Credits: based on Maya-1: all training audio is original speech from Maya-1 (Maya Research, Apache-2.0), decoded with SNAC (MIT). The
|
| 407 |
+
teacher is Kokoro-82M (hexgrad, Apache-2.0), fine-tuned with StyleTTS2 (MIT) and kikiri-tts (Apache-2.0) code; kale-tts-1-tiny keeps
|
| 408 |
+
its timing-and-melody planner and contains the Ettin 17M encoder (JHU CLSP, MIT). Pronunciations: CMUdict (BSD-2-Clause), Britfone
|
| 409 |
+
(MIT); the number, date and unit rules come from dizione and the homograph tables from tiny-voca, both by n4ze3m (Apache-2.0),
|
| 410 |
+
the tables trained on Google Research's Wikipedia Homograph Data (Apache-2.0). Training texts: public-domain books made available by Project Gutenberg. Dataset: kale-tts-1-data (CC BY 4.0).
|
| 411 |
+
|
SHA256SUMS
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
cf786abdfdf8e89962d1fb888d22decfde1efc6cf43564199ba9468788763c7b config.json
|
| 2 |
+
9fd55248d51d33976b324fc11592e28071da7d41e0e9401dfb7082e30574b7b1 ettin-tokenizer.json
|
| 3 |
+
0ad61cb8bc4899e610a317d1ddbaa4c7e5bf55c2abda41f0c746d41479800deb export-check-model.fp32.json
|
| 4 |
+
27f07f3c212bf5bcbf9a26b6fc1415284245527fd58ccfdce46c456648cfdf3f export-check-model.json
|
| 5 |
+
c535680c3645897b5b1d5e1aa12b839976ef423c05719dc823e2ece90f52f183 export-check-whisper.json
|
| 6 |
+
885675190d58a5f28f096f4698526fa2a2f2378d9d1897b6b0721596f585f64f model.fp32.onnx
|
| 7 |
+
8f255ef6f2b22c130cce15bdf92c5d420a821b2e5e39dbdef34064d52d6dc495 model.onnx
|
| 8 |
+
61188314434d9972e42677fb71dba9e19aa8698e980541b1c06a1f9f16086e60 tokenizer.json
|
| 9 |
+
be1cb066d6ef6b074b3f15e6a6dd21ac88ff3cdaedf325f0aaed686c70f75d20 tokenizer_config.json
|
| 10 |
+
74af8aefa05d0c7eb24278a80040b57be8e552f95163e15478d8e6027a1be63e voices.json
|
| 11 |
+
179741da5b5fb1f7d49399043f4788f78c28eaf02b00115aa8f3ffee3ad4cb6b voices/d03.bin
|
| 12 |
+
c026f7cef743b802088f49c6d0790978234336c4b13ca0344b15692dee4838f8 voices/d03.extra.bin
|
| 13 |
+
add53ad105ba63b83e39bd85f3bfa96b2375bf550caa65d6c99feb7e66e7cee3 voices/d13.bin
|
| 14 |
+
29f613b9e9aed386a1b1c46691d8d04ec8ad1a56f271ffe49f1a57e0efc2a7a4 voices/d13.extra.bin
|
| 15 |
+
d8335f35bf3d3446e2c8cc460936a06cde2aab2f3f8ccba93c612bafadfc541d voices/f06.bin
|
| 16 |
+
e09a4184f7a440a771608e261f30fee2042b052765f02ca232141be564dd168d voices/f06.extra.bin
|
| 17 |
+
3ed78f53ea23af5b559e0511520c35193dafb4a6bc478a6babb81f1afcce270e voices/h013f.bin
|
| 18 |
+
6ffa4f65360df91caca5b17ae618450e846f2555f9b98d5f7e6ab989397eed58 voices/h013f.extra.bin
|
| 19 |
+
2d63ba440f340d6d2dff8d71178d3409375c253758aed97b7a1e370e49520ecf voices/m3.bin
|
| 20 |
+
4410afd6de29345f7fe1290c4f3e8fba3aa10b98f7ce8d408f2214e4f2e56cb4 voices/m3.extra.bin
|
| 21 |
+
6efc770ae27fcbe0ba68b3a8c67b4a7fb86fe7c8b364a4f2b3f2c729e377b4c1 voices/s057b.bin
|
| 22 |
+
1414630e357da14a528d4d6153c7e3eb2b2f2bc7b92f29c56c61718fc1405e9e voices/s057b.extra.bin
|
| 23 |
+
29f9c895a09cd1165420a1ca0808a6ebdfa016686c8b9a5e1ca52d750105610e voices/t071.bin
|
| 24 |
+
a34b744def95dce7d41d3684d09f08d77d1cdb77ea5bae4be16d7b954026ad6e voices/t071.extra.bin
|
| 25 |
+
8c745b9b8b9e885d4e5d79173d9af2edfe2768d8c190776dbe45ee31bc2bb257 voices/w165.bin
|
| 26 |
+
e4b85121125172cac19ede1de6043687623320faba5c206124a76e790d0c456f voices/w165.extra.bin
|
| 27 |
+
36f07dd7fbe6bd76f8607f651bbb0d235632476ff9ec5c1805e496d8cd490fda voices/w602.bin
|
| 28 |
+
4a0fe5fb0e543cba7fa12d164007e89e84058c5cd7f83c299d080daa5721df81 voices/w602.extra.bin
|
| 29 |
+
6d9c428c34874279c6f8503cc1b9de42eef3a7dfbeddc9e486efea65cccf4a9b voices/x328.bin
|
| 30 |
+
65a8debc75ee03d887ba0b460be3f474e261537e98d9d2e7d07faa3dcd16d299 voices/x328.extra.bin
|
THIRD_PARTY_NOTICES.md
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Third-party notices
|
| 2 |
+
|
| 3 |
+
kale-tts-1 (weights and code: Apache-2.0; dataset: CC BY 4.0) includes or is derived from the works below. Their licences and notices
|
| 4 |
+
travel with every copy. The full Apache License 2.0 text is in `LICENSE` (and in `frontend/dizione/LICENSE`).
|
| 5 |
+
|
| 6 |
+
## Model weights
|
| 7 |
+
- **Kokoro-82M** (hexgrad, huggingface.co/hexgrad/Kokoro-82M, Apache-2.0). The kale-tts-1 text side starts from Kokoro-82M's weights.
|
| 8 |
+
Changes: fine-tuned on the kale-tts-1 voices, distilled to smaller text sides, joined to a new decoder, and exported to ONNX.
|
| 9 |
+
The IPA-to-id table (`tokenizer.json`, `frontend/matcha/ipa2kokoro.json`) is Kokoro's.
|
| 10 |
+
- **Maya-1** (Maya Research, huggingface.co/maya-research/maya1, Apache-2.0). All training audio is original Maya-1 output from text
|
| 11 |
+
voice descriptions (decoded with SNAC, MIT, Copyright (c) 2023 Descript, Copyright (c) 2024 Hubert Siuzdak). Based on Maya. Every voice
|
| 12 |
+
is synthetic and is nobody real; follow the Maya-1 use policy (no impersonation, never present the audio as a human recording).
|
| 13 |
+
- **StyleTTS2** (github.com/yl4579/StyleTTS2, MIT, Copyright (c) 2023 Aaron (Yinghao) Li) and **kikiri-tts** (github.com/semidark/kikiri-tts,
|
| 14 |
+
Apache-2.0): the teacher's training code.
|
| 15 |
+
|
| 16 |
+
- **Ettin encoder 17M** (jhu-clsp/ettin-encoder-17m, github.com/JHU-CLSP/ettin-encoder-vs-decoder, MIT): kale-tts-1-tiny's text side
|
| 17 |
+
contains its weights (frozen) and ships its tokenizer as `ettin-tokenizer.json`; `frontend/ettin.js` reimplements the tokenizer.
|
| 18 |
+
|
| 19 |
+
```
|
| 20 |
+
MIT License
|
| 21 |
+
|
| 22 |
+
Copyright (c) 2025 Johns Hopkins University Center for Language and Speech Processing
|
| 23 |
+
|
| 24 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
|
| 25 |
+
"Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish,
|
| 26 |
+
distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to
|
| 27 |
+
the following conditions:
|
| 28 |
+
|
| 29 |
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
| 30 |
+
|
| 31 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 32 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
| 33 |
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
| 34 |
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
## Text front end (`frontend/`)
|
| 38 |
+
- **CMUdict** (github.com/cmusphinx/cmudict, BSD-2-Clause style). `frontend/matcha/lexicon.tsv`, the en-gb word list
|
| 39 |
+
(`frontend/matcha/en-gb/lexicon.tsv`), the unknown-word guessers (`g2p.bin`) and the `kokoro-compatible/lexicon-us-en.txt` files are
|
| 40 |
+
made from it. Its licence:
|
| 41 |
+
|
| 42 |
+
```
|
| 43 |
+
Copyright (C) 1993-2015 Carnegie Mellon University. All rights reserved.
|
| 44 |
+
|
| 45 |
+
Redistribution and use in source and binary forms, with or without
|
| 46 |
+
modification, are permitted provided that the following conditions
|
| 47 |
+
are met:
|
| 48 |
+
|
| 49 |
+
1. Redistributions of source code must retain the above copyright
|
| 50 |
+
notice, this list of conditions and the following disclaimer.
|
| 51 |
+
The contents of this file are deemed to be source code.
|
| 52 |
+
|
| 53 |
+
2. Redistributions in binary form must reproduce the above copyright
|
| 54 |
+
notice, this list of conditions and the following disclaimer in
|
| 55 |
+
the documentation and/or other materials provided with the
|
| 56 |
+
distribution.
|
| 57 |
+
|
| 58 |
+
This work was supported in part by funding from the Defense Advanced
|
| 59 |
+
Research Projects Agency, the Office of Naval Research and the National
|
| 60 |
+
Science Foundation of the United States of America, and by member
|
| 61 |
+
companies of the Carnegie Mellon Sphinx Speech Consortium. We acknowledge
|
| 62 |
+
the contributions of many volunteers to the expansion and improvement of
|
| 63 |
+
this dictionary.
|
| 64 |
+
|
| 65 |
+
THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND
|
| 66 |
+
ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
| 67 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
| 68 |
+
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
|
| 69 |
+
NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 70 |
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 71 |
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 72 |
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 73 |
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 74 |
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 75 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
- **Britfone 3.0.1** (github.com/JoseLlarena/Britfone, MIT). The en-gb word list (`frontend/matcha/en-gb/lexicon.tsv`) uses it.
|
| 79 |
+
|
| 80 |
+
```
|
| 81 |
+
MIT License
|
| 82 |
+
|
| 83 |
+
Copyright (c) 2017 Jose Llarena
|
| 84 |
+
|
| 85 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
|
| 86 |
+
"Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish,
|
| 87 |
+
distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to
|
| 88 |
+
the following conditions:
|
| 89 |
+
|
| 90 |
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
| 91 |
+
|
| 92 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 93 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
| 94 |
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
| 95 |
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
+
- **dizione** (github.com/n4ze3m/dizione, Apache-2.0, `frontend/dizione/LICENSE`): the number, date, time, unit and abbreviation rules in
|
| 99 |
+
`frontend/dizione/` are a port of its text rules. The homograph tables (`frontend/dizione/homographs.data.js`) come from
|
| 100 |
+
github.com/n4ze3m/tiny-voca (Apache-2.0), trained on the Wikipedia Homograph Data (github.com/google-research-datasets/WikipediaHomographData,
|
| 101 |
+
Apache-2.0; Gorman, Mazovetskiy and Nikolaev, LREC 2018); the tables hold word lists and weights only, no Wikipedia text.
|
| 102 |
+
|
| 103 |
+
## Training recipe (`recipe/`)
|
| 104 |
+
- **Paradee** (github.com/sahilmahendrakar/paradee @ 2de547e45da92840a636c499eb0782e988be1e47, Apache-2.0): `vhead.py`,
|
| 105 |
+
`student_decoder.py` and `discriminators.py`, copied unchanged into `recipe/train/third_party/paradee/` with its LICENSE and NOTICE.
|
| 106 |
+
No Paradee weights are used.
|
| 107 |
+
- StyleTTS2 / AuxiliaryASR (MIT, Copyright (c) 2022-2023 Aaron (Yinghao) Li) and kikiri-tts (Apache-2.0): cloned at pinned revisions by
|
| 108 |
+
`recipe/teacher/`; one class copied from AuxiliaryASR is marked in `recipe/teacher/teacher.py`.
|
| 109 |
+
|
| 110 |
+
## Browser demo (`space/`)
|
| 111 |
+
- **onnxruntime-web** (github.com/microsoft/onnxruntime, MIT, Copyright (c) Microsoft Corporation): `space/ort/`, with its `LICENSE`.
|
checkpoints/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!-- SPDX-License-Identifier: Apache-2.0 | Copyright 2026 Kale -->
|
| 2 |
+
# kale-tts-1-tiny training checkpoints (PyTorch)
|
| 3 |
+
|
| 4 |
+
The trained parts `model.onnx` was exported from, for fine-tuning with `recipe/`. Weights only (no optimiser states), Apache-2.0.
|
| 5 |
+
The teacher and the voice packs live in [kale-tts-1-base](https://huggingface.co/KaleComputer/kale-tts-1-base) (Kokoro-82M fine-tuned on
|
| 6 |
+
the 10 voices); tiny keeps its timing-and-melody planner, frozen.
|
| 7 |
+
|
| 8 |
+
| file | what |
|
| 9 |
+
|---|---|
|
| 10 |
+
| `tiny/ettin_text_side_fle.pt` | tiny's text side: a 3.0M phoneme reader next to the frozen Ettin encoder (jhu-clsp/ettin-encoder-17m), distilled from kale-tts-1-base |
|
| 11 |
+
| `tiny/pitch_heads_flp.pt` | pitch / loudness heads + per-voice offsets `pv` (10 x 128), trained on the voices' Maya-1 audio |
|
| 12 |
+
| `tiny/duration_head_fld.pt` | duration head (pace windows), `pv` frozen from the pitch heads |
|
| 13 |
+
| `tiny/decoder_flkd.pt` | tiny's 3.65M sound generator, 10 style rows, with its two critics (`model`, `D`, `J`) |
|
| 14 |
+
|
| 15 |
+
Voice order in every per-voice table: s057b, f06, d03, w165, w602, m3, t071, d13, x328, h013f.
|
checkpoints/packs/d03.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b89468eb5f045e59801fda533a701681d5443678d1618aa8748bc7350735758f
|
| 3 |
+
size 523725
|
checkpoints/packs/d13.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1d1ed650484a715b6f95e11bddb568eef9e7f075cfcd10e770e5b20575743bfe
|
| 3 |
+
size 523725
|
checkpoints/packs/f06.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f019be1bb369ecf4a72de48229d81e25a83fb139b4ae770a38dcb64bac6c866d
|
| 3 |
+
size 523725
|
checkpoints/packs/h013f.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9a17c771fa742aceb463ebda7046feaeef0759fb0969f0cf5efa0df0bb39b238
|
| 3 |
+
size 523739
|
checkpoints/packs/m3.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:debe2fbff7ae859440f4ad0f6bdd15f3a3767fd97430614f54ae53ca567205fb
|
| 3 |
+
size 523654
|
checkpoints/packs/s057b.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:dfb27b61fef7ac260a4ad18d57101368eec1d218deeba418313872f7c64cc531
|
| 3 |
+
size 523739
|
checkpoints/packs/t071.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:afaa385a2a34b1997c0c461b15214c70a85ca353b7b41c863fd82b17e8021307
|
| 3 |
+
size 523732
|
checkpoints/packs/w165.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d2f7432cc4a6533dafc9cdd8ec27b9bcb8514c748570e63d8e4f83d17cd14309
|
| 3 |
+
size 523732
|
checkpoints/packs/w602.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:63f979297a1aceda77a88f0a454511ee8d7455afd730f902d4679580aa1d1d75
|
| 3 |
+
size 523732
|
checkpoints/packs/x328.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0d057bdcb69ac3024b641f6f7f28fcb7e45a21990a204dd0e2d56bf9c9478489
|
| 3 |
+
size 523732
|
checkpoints/teacher/kokoro_teacher.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b1c52046c5d25df637f0353ffd63dae69a1ab07e8f72d5957c06c98347167301
|
| 3 |
+
size 327227339
|
checkpoints/tiny/decoder_flkd.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fced143f056dfc814ec153c837904436f9d665e24873304692ea5602c178f23c
|
| 3 |
+
size 32394651
|
checkpoints/tiny/decoder_t10k.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ae50b0c0fe3255d20487cdbaff8b4a5c46811b63311819e162bfe018a11d003d
|
| 3 |
+
size 32393811
|
checkpoints/tiny/duration_head_fld.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7fb260b44a766ad52f0b6ce351db60fcf4f7cbbe2e5de0d588d250fcb332a67b
|
| 3 |
+
size 7467441
|
checkpoints/tiny/duration_head_t10d2.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3c268d8c9f33a112b413a12aa32ced9d90e318c400543f95ec365a5a91809b45
|
| 3 |
+
size 7467441
|
checkpoints/tiny/ettin_text_side_fle.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4d6ff11c746e1e94ffd80974d7631704d6c14a82c5c7c24fb07297ae518d9285
|
| 3 |
+
size 12034253
|
checkpoints/tiny/ettin_text_side_t10e.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:70a118abe4cadf560b981f754adb6975244ea5aee8e42dbf589b9c2315025a70
|
| 3 |
+
size 12034089
|
checkpoints/tiny/pitch_heads_flp.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:95daba5fb9b81053c6d038b6588686b2ef1a792611eaf0b2d99af8d8d99f7532
|
| 3 |
+
size 33741899
|
checkpoints/tiny/pitch_heads_t10p.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4fd0a203e25cec70c18f78405648c7204c928c2a772322841411841cfdd3a89b
|
| 3 |
+
size 33741899
|
config.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"StyleTextToSpeech2Model"
|
| 4 |
+
],
|
| 5 |
+
"model_type": "style_text_to_speech_2"
|
| 6 |
+
}
|
diagrams/benches.png
ADDED
|
Git LFS Details
|
diagrams/birth.png
ADDED
|
Git LFS Details
|
diagrams/data.png
ADDED
|
Git LFS Details
|
diagrams/datacontents.png
ADDED
|
Git LFS Details
|
diagrams/datamade.png
ADDED
|
Git LFS Details
|
diagrams/demo-nano.png
ADDED
|
Git LFS Details
|
diagrams/demo-tiny.png
ADDED
|
Git LFS Details
|
diagrams/extend.png
ADDED
|
Git LFS Details
|
diagrams/flow-nano.png
ADDED
|
Git LFS Details
|
diagrams/flow-tiny.png
ADDED
|
Git LFS Details
|
diagrams/header-base.png
ADDED
|
Git LFS Details
|
diagrams/header-data.png
ADDED
|
Git LFS Details
|
diagrams/header-nano.png
ADDED
|
Git LFS Details
|
diagrams/header-tiny.png
ADDED
|
Git LFS Details
|
diagrams/madeof-nano.png
ADDED
|
Git LFS Details
|
diagrams/madeof-tiny.png
ADDED
|
Git LFS Details
|
diagrams/measure.png
ADDED
|
Git LFS Details
|
diagrams/phonemes.png
ADDED
|
Git LFS Details
|
diagrams/soundside-nano.png
ADDED
|
Git LFS Details
|
diagrams/soundside.png
ADDED
|
Git LFS Details
|
diagrams/textside-nano.png
ADDED
|
Git LFS Details
|
diagrams/textside.png
ADDED
|
Git LFS Details
|
diagrams/voices.png
ADDED
|
Git LFS Details
|