API Reference
Text to Speech

Text-to-Speech

textToSpeech(text: string, options?: TTSOptions)

Converts text to speech.

const audioBuffer = await browserAI.textToSpeech('Hello world', {
  voice: 'female_a',
  speed: 1.0
});

Parameters

ParameterTypeRequiredDescription
textstringYesText to convert
optionsTTSOptionsNoTTS settings

TTSOptions

OptionTypeDefaultDescription
voicestring'female_a'Voice selection
speednumber1.0Speech rate
pitchnumber1.0Voice pitch
qualitystring'medium'Audio quality

Returns

Promise<ArrayBuffer>