useTextToSpeech<
K>(config,options?):object
Defined in: hooks/useTextToSpeech.ts:31
React hook to load and run the Kokoro Text-to-Speech pipeline.
This hook manages downloading (if remote URLs are provided) and loading the model assets, phonemizer files, and voice style vectors, tracking download progress and load errors, and releasing native memory when the component unmounts or the configuration changes.
For imperative usage, see createKokoroTextToSpeech.
K extends PropertyKey
Voice keys record constraint.
The Kokoro TTS model configuration. See KokoroTtsModel.
Load and caching options. See ResourceOptions.
The same object as KokoroTextToSpeech (without dispose),
combined with loading state and download progress.
downloadProgress:
number
Download progress across every asset, in percent.
error:
Error|undefined
The download or load error, if any.
isReady:
boolean
Whether the pipeline is loaded and ready to synthesize.
resource:
KokoroTtsModel<K> |undefined
The config with every remote URL resolved to a local path.
synthesize: (
text,options) =>AsyncGenerator<KokoroTtsChunk> |undefined
Streams synthesized audio chunks. Undefined until the pipeline is ready.
synthesizeStop: () =>
void|undefined
Cancels an in-flight synthesis. Undefined until the pipeline is ready.
useTextToSpeech<
K>(config,options?):object
Defined in: hooks/useTextToSpeech.ts:67
React hook to load and run the Supertonic 3 Text-to-Speech pipeline.
This hook manages downloading (if remote URLs are provided) and loading the model assets, indexer files, and voice style vectors, tracking download progress and load errors, and releasing native memory when the component unmounts or the configuration changes.
For imperative usage, see createSupertonicTextToSpeech.
K extends PropertyKey
Voice style keys record constraint.
The Supertonic TTS model configuration. See SupertonicTtsModel.
Load and caching options. See ResourceOptions.
The same object as SupertonicTextToSpeech (without dispose),
combined with loading state and download progress.
downloadProgress:
number
Download progress across every asset, in percent.
error:
Error|undefined
The download or load error, if any.
isReady:
boolean
Whether the pipeline is loaded and ready to synthesize.
resource:
SupertonicTtsModel<K> |undefined
The config with every remote URL resolved to a local path.
synthesize: (
text,options) =>AsyncGenerator<SupertonicTtsChunk> |undefined
Streams synthesized audio chunks. Undefined until the pipeline is ready.
synthesizeStop: () =>
void|undefined
Cancels an in-flight synthesis. Undefined until the pipeline is ready.