Skip to main content

ovos-tts-plugin-kokoro

Status: Proof of Concept

POC status — experimental, not for production, may be abandoned. No API stability promise.

OVOS TTS plugin for Kokoro — an 82M parameter multilingual TTS model by hexgrad. Same engine used by VoiceMode, now wired up for the standard OVOS voice assistant.

Install

pip install ovos-tts-plugin-kokoro

espeak-ng is required for the underlying G2P stack:

# Debian/Ubuntu
sudo apt-get install espeak-ng
# macOS
brew install espeak-ng

English voices also need spaCy's en_core_web_sm model. Misaki (the Kokoro G2P library) attempts to download it on first use but does not reload it in the same process, so you'll want to install it ahead of time:

python -m spacy download en_core_web_sm

For Japanese or Chinese voices, install the optional G2P extras:

pip install "ovos-tts-plugin-kokoro[ja,zh]"

Linux: CPU-only torch (saves ~2GB)

On Linux, pip defaults to the CUDA torch wheel (~2.5GB). If you don't need GPU support, install torch from the CPU index first:

pip install torch --index-url https://download.pytorch.org/whl/cpu
pip install ovos-tts-plugin-kokoro

On macOS, this is not needed — PyPI torch is already CPU-only (~60MB). With uv, torch automatically resolves to the CPU-only wheel via the tool.uv.sources block in pyproject.toml.

Configuration

{
  "tts": {
    "module": "ovos-tts-plugin-kokoro",
    "ovos-tts-plugin-kokoro": {
      "voice": "af_bella"
    }
  }
}

Voice options

Kokoro ships 56 built-in voices across 9 languages. The voice id encodes language + gender:

Prefix Language Examples
af_ American English (F) af_bella, af_heart, af_nicole
am_ American English (M) am_michael, am_onyx, am_eric
bf_ British English (F) bf_alice, bf_emma, bf_lily
bm_ British English (M) bm_george, bm_fable, bm_daniel
jf_ / jm_ Japanese jf_alpha, jm_kumo (needs [ja] extra)
zf_ / zm_ Mandarin zf_xiaoxiao, zm_yunjian (needs [zh] extra)
ef_ / em_ Spanish ef_dora, em_alex
ff_ French (F) ff_siwis
hf_ / hm_ Hindi hf_alpha, hm_omega
if_ / im_ Italian if_sara, im_nicola
pf_ / pm_ Brazilian Portuguese pf_dora, pm_alex

The voice id determines which Kokoro language pipeline is used, regardless of the OVOS active language. Picking bm_george will speak through the British pipeline even if lang is en-US.

See the full hexgrad/Kokoro-82M VOICES.md for samples.

Language support

The plugin maps the active OVOS language (BCP-47, e.g. fr-FR) to a Kokoro single-letter language code:

OVOS lang Kokoro code Language
en / en-us a American English
en-gb b British English
es e Spanish
fr f French
hi h Hindi
it i Italian
ja j Japanese
pt / pt-br p Brazilian Portuguese
zh z Mandarin

Lookup tries the full BCP-47 tag first (e.g. en-gb), then falls back to the base subtag, then to American English. Unknown languages fall back to American English with a log line. The voice id always wins over the language map — a voice prefixed bm_ always uses the British pipeline.

Override the language map

{
  "tts": {
    "module": "ovos-tts-plugin-kokoro",
    "ovos-tts-plugin-kokoro": {
      "voice": "af_bella",
      "speed": 1.0,
      "language_aliases": {
        "en": "b"
      },
      "preload_languages": ["en", "fr"]
    }
  }
}
Key Type Default Description
voice str af_bella Any built-in voice id (see table above).
speed float 1.0 Playback speed multiplier passed to KPipeline.
sample_rate int 16000 Output sample rate in Hz. Kokoro's native rate is 24000; the plugin resamples.
device str or null "cpu" Torch device — "cpu", "cuda", "mps", or null to let Kokoro auto-select.
language_aliases dict {} Override or extend the BCP-47 → Kokoro code map.
preload_languages list[str] [] BCP-47 codes to load eagerly during plugin init instead of lazy-loading.

Memory note: Each loaded language pipeline holds the 82M parameter model + a g2p stack. The plugin caches one pipeline per (language, device) pair, so leaving preload_languages empty and letting the cache warm on demand keeps the resident set small.

Apple Silicon note: Despite MPS being available on M-series Macs, CPU is the fastest device for Kokoro on Apple Silicon. The vocoder leans heavily on torch.stft/istft, which are weak spots on the Metal backend — measured RTF on an M3 Max was ~0.08 on CPU vs ~0.40 on MPS. The default of "cpu" is intentional; only set device to "cuda" if you actually have a discrete NVIDIA GPU.

Lip sync (visemes)

The plugin returns phoneme timing alongside the audio, so enclosures with a mouth (the Mark 1 and the virtual Mark 1) animate in sync with the voice without a G2P plugin.

Kokoro's model predicts a duration for every phoneme it speaks. The plugin converts those predictions into the OVOS phoneme:end_time format (lowercase ARPAbet keys, cumulative seconds), including the leading silence the model adds before speech. ovos-audio turns that into enclosure.mouth.viseme_list messages.

This is more accurate than the G2P fallback path, which guesses a constant duration per phoneme. If timing is ever unavailable the plugin returns no phonemes and OVOS falls back to the configured G2P plugin, if any.

Non-English voices work too: every sound in Kokoro's phoneme alphabet maps to the nearest English mouth shape.

License

Apache-2.0

Metadata

Release files for ovos-tts-plugin-kokoro 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ovos-tts-plugin-kokoro 0.4.0
File Size Uploaded
ovos_tts_plugin_kokoro-0.4.0.tar.gz 20.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ovos-tts-plugin-kokoro 0.4.0
File Interpreter ABI Platform
ovos_tts_plugin_kokoro-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 36.1 kB

Release files / ovos_tts_plugin_kokoro-0.4.0.tar.gz

Download URL ovos_tts_plugin_kokoro-0.4.0.tar.gz
Size 20.2 kB
Tags Source
SHA-256 checksum
How to use checksums
624fc7ea1e5ae8aa739905e17c7fc4653261fb4fad7c48dcbaab015d660308b6
BLAKE2b-256 checksum
How to use checksums
089cdd385edde834c3ef980cd1946372b5d368658da8562a29c5c57a6e9c2844
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / ovos_tts_plugin_kokoro-0.4.0-py3-none-any.whl

Download URL ovos_tts_plugin_kokoro-0.4.0-py3-none-any.whl
Size 15.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c74fe2b68e51072b7cb912dc2315de41d6ebcff3e3165c58d972979cf35e6056
BLAKE2b-256 checksum
How to use checksums
5bd1987f775a480094d34384daabc6933afe973b1a5d0e054802a973f9513acc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page