Skip to main content

Module engine

Module engine 

Source
Expand description

The in-process Kokoro-82M engine.

Re-exportsยง

use std::sync::Mutex; ๐Ÿ”’
use std::sync::mpsc; ๐Ÿ”’
use tokio::sync::mpsc as tokio_mpsc; ๐Ÿ”’
use crate::model::ModelFiles; ๐Ÿ”’
use crate::Chunk; ๐Ÿ”’
use crate::Engine; ๐Ÿ”’
use crate::Error; ๐Ÿ”’
use crate::SpeakRequest; ๐Ÿ”’

Structsยง

Job ๐Ÿ”’
Kokoro ๐Ÿ”’
The loaded engine, as the wire conversion sees it.
KokoroTts
A loaded Kokoro-82M pipeline. One render thread per engine, so a second utterance queues behind the first; the thread owns the ONNX session and the runtime the engineโ€™s async API needs.

Constantsยง

DEFAULT_VOICE
The voice an utterance renders in when the request names none.
SAMPLE_RATE
The wireโ€™s sample rate: 24 kHz mono 16-bit. Kokoro renders at this rate natively; anything else is resampled once, here.

Traitsยง

Renderer ๐Ÿ”’
What the engineโ€™s inference looks like to the wire conversion, so a test can drive the conversion with no model load.

Functionsยง

chunk_for ๐Ÿ”’
One render: the voice the request names, the modelโ€™s samples, and the wireโ€™s own shape.
pcm16 ๐Ÿ”’
The wireโ€™s sample: clamp to [-1, 1], then the signed 16-bit range.
refused ๐Ÿ”’
A channel carrying one failure, for a render thread that is gone.
resample ๐Ÿ”’
Linear resampling to the wire rate; identity when the rates match.
select_voice
The installed voices a request is checked against.