Expand description
Kokoro-82M text-to-speech, in process.
Text goes through loqui_g2p (misaki’s English G2P, GPL-free), is cut
into chunks of at most 510 phonemes exactly as Kokoro’s own KPipeline
cuts it, and each chunk runs through the ONNX export of Kokoro on ONNX
Runtime. The result is 24 kHz mono f32, trimmed of edge silence and
peak-normalised the way open-speech delivers it.
Weights are not bundled. Point KokoroModel::load at
onnx/model.onnx and Kokoro::new at the voices/ directory of
onnx-community/Kokoro-82M-v1.0-ONNX (Apache-2.0).
Modules§
- post
- open-speech’s output post-processing (
src/audio/postprocessing.py): drop leading and trailing near-silence, then scale to a fixed peak.
Structs§
- Blend
- A voice to speak in: one or more voice packs whose weights sum to one.
- Kokoro
- Text in, audio out.
Send + Sync: share one per process. - Kokoro
Model - Voice
Enums§
Constants§
- DEFAULT_
VOICE - Kokoro’s default voice, and what OpenAI’s
alloymaps to. - ENGLISH_
VOICES - Kokoro v1.0’s American (
a*) and British (b*) voices: the ones this crate can phonemize for.f/min the second letter is the speaker’s voice type as Kokoro labels it. - MAX_
PHONEMES - Rows in a pack, and so the longest phoneme sequence Kokoro accepts.
- SAMPLE_
RATE - Output sample rate.
- STYLE_
DIM
Functions§
- chunks
KPipeline.en_tokenize: the phoneme string of each chunk, in order. Empty chunks are dropped, asgenerate_from_tokensskips them.- resolve_
alias - OpenAI’s voice names, mapped the way open-speech maps them, so a client
written against OpenAI keeps working.
Blendapplies this to each part of a spec. - tokens_
to_ ps KPipeline.tokens_to_ps: each token’s phonemes, a space after those followed by whitespace, trimmed.