TextToSpeechOptions interface

Options to configure the MediaPipe TextToSpeech Task on the Web.

Signature:

export declare interface TextToSpeechOptions extends TaskRunnerOptions 

Properties

Property Modifiers Type Description
defaultVoiceId string Optional default voice ID (e.g. "af_heart"). When unset, the engine's default voice is used.
defaultLocale string Optional default BCP-47 locale (e.g. "en-US"). When unset, inferred from the selected voice metadata.
speakingRate number Speaking rate multiplier in (0.0, 4.0]. Defaults to 1.0 (normal speed).
targetBucket number Target sequence length bucket for static-shape Kokoro models (0 = auto).
cacheDirectory string Optional directory path in the Wasm virtual filesystem for caching unpacked .litertlm assets and compiled weights.
modelAssetSize number Optional byte length of baseOptions.modelAssetBuffer when provided as a ReadableStreamDefaultReader.

TextToSpeechOptions.defaultVoiceId

Optional default voice ID (e.g. "af_heart"). When unset, the engine's default voice is used.

Signature:

defaultVoiceId?: string;

TextToSpeechOptions.defaultLocale

Optional default BCP-47 locale (e.g. "en-US"). When unset, inferred from the selected voice metadata.

Signature:

defaultLocale?: string;

TextToSpeechOptions.speakingRate

Speaking rate multiplier in (0.0, 4.0]. Defaults to 1.0 (normal speed).

Signature:

speakingRate?: number;

TextToSpeechOptions.targetBucket

Target sequence length bucket for static-shape Kokoro models (0 = auto).

Signature:

targetBucket?: number;

TextToSpeechOptions.cacheDirectory

Optional directory path in the Wasm virtual filesystem for caching unpacked .litertlm assets and compiled weights.

Signature:

cacheDirectory?: string;

TextToSpeechOptions.modelAssetSize

Optional byte length of baseOptions.modelAssetBuffer when provided as a ReadableStreamDefaultReader.

Signature:

modelAssetSize?: number;