diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-10-12 22:50:22 -0400 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-10-13 12:20:56 -0400 |
commit | 21a2730cdeef80327285f77a155451a8fbf67939 (patch) | |
tree | 01f53f126535e5d7109a4822d07b8c3967ebe918 /ext/mixed | |
parent | 2f88bcf82c4dd82d1dd2f035717effaa2673e3c2 (diff) |
Add option for text-to-speech
Diffstat (limited to 'ext/mixed')
-rw-r--r-- | ext/mixed/js/audio.js | 13 |
1 files changed, 13 insertions, 0 deletions
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; +} |