Skip to main content
Version: 0.10.0

Function: createKokoroTextToSpeech()

createKokoroTextToSpeech<K>(config, runtime?): Promise<KokoroTextToSpeech<K>>

Defined in: extensions/speech/tasks/kokoroTextToSpeech.ts:163

Creates a Kokoro Text-to-Speech pipeline.

It validates both sub-model method schemas, builds the grapheme-to-phoneme pipeline, pre-parses the voice files into memory, and registers disposal hooks to release all native resources.

Type Parameters

K

K extends PropertyKey

Voice keys record constraint.

Parameters

config

KokoroTtsModel<K>

Kokoro TTS pipeline configuration containing model and asset paths. See KokoroTtsModel.

runtime?

any

Optional worklet runtime thread on which to run inference.

Returns

Promise<KokoroTextToSpeech<K>>

A promise resolving to the instantiated KokoroTextToSpeech runner.

Throws

With code LOAD_FAILED if models or voice files fail to load, SCHEMA_MISMATCH if model schemas do not match the Kokoro specification, or INVALID_STATE if phonemizer native support is missing.