Skip to main content
Version: Next

Interface: TextToSpeechStreamingInput

Defined in: types/tts.ts:259

Text to Speech streaming input definition

Streaming mode in T2S is synchronized by passing specific callbacks executed at given moments of the streaming. Actions such as playing the audio should happen within the onNext callback. Callbacks can be both synchronous or asynchronous.

Enables an incrementally expanded input, in other words adding new text chunks with streamInsert() as the streaming is running.

Extends

Properties

lang?

optional lang: TextToSpeechSupertonicLanguage

Defined in: types/tts.ts:152

supertonic only: language token for this call (e.g. 'en', 'na'). Overrides the config's lang for this synthesis without reloading the model. Defaults to the config's lang (or 'na').

Inherited from

TextToSpeechInput.lang


onBegin()?

optional onBegin: () => void | Promise<void>

Defined in: types/tts.ts:241

Called when streaming begins

Returns

void | Promise<void>

Inherited from

TextToSpeechStreamingCallbacks.onBegin


onEnd()?

optional onEnd: () => void | Promise<void>

Defined in: types/tts.ts:243

Called when streaming ends

Returns

void | Promise<void>

Inherited from

TextToSpeechStreamingCallbacks.onEnd


onNext()?

optional onNext: (audio) => void | Promise<void>

Defined in: types/tts.ts:242

Called after each audio chunk gets calculated.

Parameters

audio

Float32Array

Returns

void | Promise<void>

Inherited from

TextToSpeechStreamingCallbacks.onNext


phonemize?

optional phonemize: boolean

Defined in: types/tts.ts:144

kokoro only: treat input as text (true) or IPA phonemes (false).

Inherited from

TextToSpeechInput.phonemize


speed?

optional speed: number

Defined in: types/tts.ts:142

optional speed argument - the higher it is, the faster the speech becomes

Inherited from

TextToSpeechInput.speed


stopAutomatically?

optional stopAutomatically: boolean

Defined in: types/tts.ts:261

If true, streaming will stop automatically when the buffer is empty.


text?

optional text: string

Defined in: types/tts.ts:141

a text to be spoken

Inherited from

TextToSpeechInput.text


totalSteps?

optional totalSteps: number

Defined in: types/tts.ts:146

supertonic only: number of flow-matching steps (default 8).

Inherited from

TextToSpeechInput.totalSteps