# Africa engine expansion

The first markets are **Kenya, Nigeria, South Africa, and Ghana**. The catalog
contains 51 configured voice profiles when the local OmniVoice worker is enabled,
across VITS, OmniVoice and Edge neural engines (42 with OmniVoice disabled).
A profile can share an underlying cloud voice with a different prosody preset.
The catalog also includes 20 standard English voices from the US, UK, Canada and
Australia alongside the African priority markets.

| Market | Available speech paths |
| --- | --- |
| Kenya | Existing Swahili models, Kenyan Swahili/English voices, Sheng-oriented persona, OmniVoice Swahili/English |
| Nigeria | Local Hausa and Yoruba, Nigerian English voices, OmniVoice Hausa/Yoruba/Igbo/English |
| South Africa | Regional Zulu, Afrikaans and English voices, OmniVoice Zulu/Xhosa/Afrikaans/English |
| Ghana | Local Akan and Ewe, Hausa and English foundations, OmniVoice Twi/English |

Akan is a language-family foundation model; this is not a dedicated Twi or Fante
voice claim. General English is not advertised as a Ghanaian accent. Pronunciation
and regional suitability require native-listener evaluation. Igbo, Twi and Xhosa
are enabled through the canonical OmniVoice runtime in this deployment.
Its nine supported languages can also render from a saved voice reference.
Ewe and Akan use existing MMS paths; they are not asserted as OmniVoice languages.

## Local OmniVoice and voice cloning

KaziVoice now uses the Apache-licensed canonical `k2-fsa/OmniVoice` source in a
separate offline worker, independently of the optional VoiceStudio API adapter.
The studio offers upload/microphone reference capture, private saved voices,
cross-language rendering, playback, downloads and estimated captions.
See [the runtime and cloning guide](OMNIVOICE_CLONING.md) for pinned assets,
installation, privacy boundaries, queue limits and model terms.

## Language-aware requests

Every voice declares `language_code`, an optional regional `locale`, `countries`,
`script`, `deployment`, sample text and upstream terms. The voice's declared
language controls normalization. Swahili keeps its existing currency, date, clock
and Sheng rules. Other languages preserve NFC Unicode and whitespace; numbers
and dates remain available to the acoustic model without Swahili substitutions.
The current implementation does not claim native normalization rules for Akan,
Hausa, Yoruba, Zulu, or other added languages.

An optional request `language_code` is an assertion: it must match the selected
voice. A mismatched language is rejected rather than quietly routed elsewhere.
Dialogue lines are normalized independently using their selected voices.

```sh
curl 'http://localhost:8050/api/v1/voices?country=NG&language_code=yo'
curl 'http://localhost:8050/api/v1/languages?country=GH'
curl 'http://localhost:8050/api/v1/markets'
curl 'http://localhost:8050/api/v1/engines'
kazivoice voices --country GH
kazivoice normalize 'Ẹ káàbọ̀. 15%' --language yo
kazivoice synthesize 'Akwaaba! Yɛwɔ ha.' --voice mms_ak --output akan.mp3
kazivoice benchmark --voice mms_ha --iterations 5
```

## Bounded local execution

`VOICELLM_MAX_LOADED_MODELS=2` limits resident VITS models per process. When there
are at least two slots, the configured default model is retained once loaded;
the least recently used other model is unloaded. At a one-model limit, selecting
another voice can unload the default and affect readiness until it is loaded
again. No extra models download at startup; selecting a local voice loads its
weights on first use.

`VOICELLM_VITS_CHUNK_CHARACTERS=350` splits long scripts at punctuation and
whitespace. African diacritics, Ethiopic and Arabic scripts survive preparation.
The pipeline renders the chunks, joins waveforms and masters/encodes the result.

`VOICELLM_SYNTHESIS_CONCURRENCY=2` limits active synthesis calls per worker.
A timed-out PyTorch operation keeps its slot until the underlying work completes,
so retries cannot create unlimited concurrent model calls. Cloud/remote async
operations are cancelled on a request deadline. Limits, models and caches remain
per process, so worker count must be sized with memory and traffic measurements.

## VoiceStudio integration

Inspected upstream: https://github.com/debpalash/VoiceStudio

Pinned review commit: `8f6c113433faa1c39d0584534d7d20f469a2a419`.

KaziVoice includes an original client for VoiceStudio's `/v1/models` and
`/v1/audio/speech` interfaces. It requests WAV, validates audio, applies KaziVoice
mastering and transcodes to the selected output format. It accepts only an
operator-declared language allowlist. Model health checks verify an actual TTS
engine entry, not the OpenAI alias names. Engine advertising does not mean its
model weights are already loaded; validate first-use behavior on that server.

The backend is optional and disabled by default. Operate a separate VoiceStudio
installation, install the intended engine and weights, and verify its languages
before configuring KaziVoice. For the reviewed OmniVoice model, Igbo (`ig`), Twi
(`tw`) and Xhosa (`xh`) are in the upstream catalog.

```env
VOICELLM_VOICESTUDIO_ENABLED=true
VOICELLM_VOICESTUDIO_BASE_URL=http://your-private-speech-worker:8000
VOICELLM_VOICESTUDIO_MODEL=omnivoice
VOICELLM_VOICESTUDIO_VOICE=default
VOICELLM_VOICESTUDIO_LANGUAGES=["ig","tw","xh"]
# Supply VOICELLM_VOICESTUDIO_API_KEY if the server requires Bearer authentication.
# Raise the request deadline only after measuring the chosen CPU/GPU runtime.
```

The allowlist is a deployment assertion, not a model-training mechanism. It must
match the selected engine's real capabilities. A configured saved voice can be
used through `VOICELLM_VOICESTUDIO_VOICE`. That remote adapter does not upload
references: use the local OmniVoice cloning workflow for references saved in
KaziVoice. Remote reference management follows the independently operated service.

## Code and model terms

The VoiceStudio application is AGPL-3.0-only. No AGPL application code was copied
into KaziVoice. The separately Apache-2.0 `omnivoice/utils/text.py` informed the
adapted chunking module; its attribution is preserved in
`THIRD_PARTY_NOTICES.md` and the source header.

Facebook MMS model cards specify CC-BY-NC-4.0. OmniVoice's model card describes
its pretrained weights as CC-BY-NC and its audio tokenizer has separate Higgs Audio
and Llama terms. Neither the KaziVoice application license nor a VoiceStudio commercial
license grants rights to those weights. Voice profiles expose known terms; this
expansion does not assert commercial clearance for the added foundation models.

The local runtime tests verify valid audio, Unicode handling, duration and
routing. They do not measure native-listener quality, accent authenticity, or
production capacity. Use representative scripts and native listeners for those
acceptance decisions.
