Type Alias: CustomTtsProvider()

CustomTtsProvider: (text, voice) => Response | Audio | Promise<Response | Audio>

A custom text-to-speech callback.

Given a text and voice parameters, the callback must return either an Audio object, or a Fetch API's [Response] object containing the audio data. Both of them can also be wrapped in a Promise.

Parameters

text

string

voice

emotion

string

lang

string

options

{}

speaker

string

speed

number

variation

number

Returns

Response | Audio | Promise<Response | Audio>

Examples

application.customTtsProvider = (text) => fetch(`https://example.com/say?text=${text}`);
application.customTtsProvider = (text) => dasha.audio.fromFile(`/path/to/audio/${text}.mp3`);
Found a mistake? Let us know.

Enroll in beta

Request invite to our private Beta program for developers to join the waitlist. No spam, we promise.