Skip to content

Instantly share code, notes, and snippets.

@ahnerd
Created October 14, 2016 19:32
Show Gist options
  • Save ahnerd/bb23d0a8c1236ac15d3292e4ae880bff to your computer and use it in GitHub Desktop.
Save ahnerd/bb23d0a8c1236ac15d3292e4ae880bff to your computer and use it in GitHub Desktop.
how to SpeechSynthesisUtterance for speech synthesis in the browser(Chrome,Firefox,Opera)
speechSynthesis.onvoiceschanged = function() {
  var msg = new SpeechSynthesisUtterance();
  msg.voice = this.getVoices().filter(v => v.name == 'Cellos')[0];
  msg.text = Object.keys(window).join(' ');
  this.speak(msg);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment