TextToSpeechOptions interface

Options to configure the MediaPipe TextToSpeech Task on the Web.

Signature:

export declare interface TextToSpeechOptions extends TaskRunnerOptions 

Extends: TaskRunnerOptions

Properties

Property Type Description
defaultLocale string Optional default BCP-47 locale (e.g. "en-US"). When unset, inferred from the selected voice metadata.
defaultVoiceId string Optional default voice ID (e.g. "af_heart"). When unset, the engine's default voice is used.
modelAssetSize number Optional byte length of baseOptions.modelAssetBuffer when provided as a ReadableStreamDefaultReader.
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).

TextToSpeechOptions.defaultLocale

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

Signature:

defaultLocale?: string;

TextToSpeechOptions.defaultVoiceId

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

Signature:

defaultVoiceId?: string;

TextToSpeechOptions.modelAssetSize

Unused: the model is always written to the Wasm virtual filesystem, which the native TextToSpeech requires.

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

Signature:

modelAssetSize?: number;

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;