Type Alias: CustomTtsProvider
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?
{[x: string]: any; }
speaker
string
speed?
number
variation?
number
Returns
Examples
using an external TTS API
application.customTtsProvider = (text) => fetch(`https://example.com/say?text=${text}`);
using pre-recorded audio files
application.customTtsProvider = (text) => dasha.audio.fromFile(`/path/to/audio/${text}.mp3`);
Found a mistake? Let us know.