Skip to content

Instantly share code, notes, and snippets.

@kimitaka
Forked from mecab/twitch-speakout.js
Created July 18, 2020 10:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kimitaka/7792578d70cb16c539de9e1b2e49a17f to your computer and use it in GitHub Desktop.
Save kimitaka/7792578d70cb16c539de9e1b2e49a17f to your computer and use it in GitHub Desktop.
document.addEventListener('onEventReceived', function(obj) {
const synth = window.speechSynthesis;
if (obj.detail.command === 'PRIVMSG') {
var utter = new SpeechSynthesisUtterance(obj.detail.body);
utter.voice = synth.getVoices().filter(v => v.lang === 'ja-JP')[0];
utter.rate = 1;
utter.pitch = 1;
synth.speak(utter);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment