Skip to content

Instantly share code, notes, and snippets.

@sunb0002
Created October 6, 2018 02:56
Show Gist options
  • Save sunb0002/21e568ec9a98634c1c18ae2ad540b3cb to your computer and use it in GitHub Desktop.
Save sunb0002/21e568ec9a98634c1c18ae2ad540b3cb to your computer and use it in GitHub Desktop.
// Code detail -- https://blog.teamtreehouse.com/getting-started-speech-synthesis-api
// Demo -- https://codepen.io/matt-west/pen/wGzuJ
function sayit(text, voice) {
var msg = new SpeechSynthesisUtterance();
msg.text = text;
msg.voice = voice
speechSynthesis.speak(msg);
};
sayit ('Hello ! This is Alex','en-US');
sayit ('こんにちは ! kyokoです','ja-JP');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment