From 21a2730cdeef80327285f77a155451a8fbf67939 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 12 Oct 2019 22:50:22 -0400 Subject: Add option for text-to-speech --- ext/mixed/js/audio.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'ext/mixed') diff --git a/ext/mixed/js/audio.js b/ext/mixed/js/audio.js index b905140c..5e3b9164 100644 --- a/ext/mixed/js/audio.js +++ b/ext/mixed/js/audio.js @@ -58,3 +58,16 @@ async function audioGetFromSources(expression, sources, optionsContext, createAu } return {audio: null, source: null}; } + +function audioGetTextToSpeechVoice(voiceURI) { + try { + for (const voice of speechSynthesis.getVoices()) { + if (voice.voiceURI === voiceURI) { + return voice; + } + } + } catch (e) { + // NOP + } + return null; +} -- cgit v1.2.3