Defined in: modules/natural_language_processing/TextToSpeechModule.ts:17
Module for Text to Speech (TTS) functionalities.
delete():
void
Defined in: modules/natural_language_processing/TextToSpeechModule.ts:275
Unloads the model from memory.
void
forward(
text,speed?):Promise<Float32Array<ArrayBufferLike>>
Defined in: modules/natural_language_processing/TextToSpeechModule.ts:117
Synthesizes the provided text into speech.
Returns a promise that resolves to the full audio waveform as a Float32Array.
string
The input text to be synthesized.
number = 1.0
Optional speed multiplier for the speech synthesis (default is 1.0).
Promise<Float32Array<ArrayBufferLike>>
A promise resolving to the synthesized audio waveform.
forwardFromPhonemes(
phonemes,speed?):Promise<Float32Array<ArrayBufferLike>>
Defined in: modules/natural_language_processing/TextToSpeechModule.ts:133
Synthesizes pre-computed phonemes into speech, bypassing the built-in phonemizer.
This allows using an external G2P system (e.g. the Python phonemizer library,
espeak-ng, or any custom phonemizer).
string
The pre-computed IPA phoneme string.
number = 1.0
Optional speed multiplier for the speech synthesis (default is 1.0).
Promise<Float32Array<ArrayBufferLike>>
A promise resolving to the synthesized audio waveform.
stream(
input):AsyncGenerator<Float32Array<ArrayBufferLike>>
Defined in: modules/natural_language_processing/TextToSpeechModule.ts:147
Starts a streaming synthesis session. Yields audio chunks as they are generated.
Input object containing text and optional speed.
AsyncGenerator<Float32Array<ArrayBufferLike>>
An async generator yielding Float32Array audio chunks.
An audio chunk generated during synthesis.
streamFromPhonemes(
input):AsyncGenerator<Float32Array<ArrayBufferLike>>
Defined in: modules/natural_language_processing/TextToSpeechModule.ts:204
Starts a streaming synthesis session from pre-computed phonemes. Bypasses the built-in phonemizer, allowing use of external G2P systems.
TextToSpeechStreamingPhonemeInput
Input object containing phonemes and optional speed.
AsyncGenerator<Float32Array<ArrayBufferLike>>
An async generator yielding Float32Array audio chunks.
An audio chunk generated during synthesis.
streamInsert(
textChunk):void
Defined in: modules/natural_language_processing/TextToSpeechModule.ts:255
Inserts new text chunk into the buffer to be processed in streaming mode.
string
The text fragment to append to the streaming buffer.
void
streamStop(
instant?):void
Defined in: modules/natural_language_processing/TextToSpeechModule.ts:264
Stops the streaming process if there is any ongoing.
boolean = true
If true, stops the streaming as soon as possible. Otherwise allows the module to complete processing for the remains of the buffer.
void
staticfromModelName(config,onDownloadProgress?):Promise<TextToSpeechModule>
Defined in: modules/natural_language_processing/TextToSpeechModule.ts:39
Creates a Text to Speech instance.
Configuration object containing model and voice.
Pass one of the built-in constants (e.g. { model: KOKORO_MEDIUM, voice: KOKORO_VOICE_AF_HEART }), or use require() to pass them.
(progress) => void
Optional callback to monitor download progress, receiving a value between 0 and 1.
Promise<TextToSpeechModule>
A Promise resolving to a TextToSpeechModule instance.
import { TextToSpeechModule, KOKORO_MEDIUM, KOKORO_VOICE_AF_HEART } from 'react-native-executorch';
const tts = await TextToSpeechModule.fromModelName(
{ model: KOKORO_MEDIUM, voice: KOKORO_VOICE_AF_HEART },
);