Skip to content

Instantly share code, notes, and snippets.

@henriquegogo
Created June 25, 2020 15:50
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 henriquegogo/6d3d17e5283b888257ee130361102d6d to your computer and use it in GitHub Desktop.
Save henriquegogo/6d3d17e5283b888257ee130361102d6d to your computer and use it in GitHub Desktop.
Speech recognition and speak using native browser API
let recognition = new webkitSpeechRecognition();
recognition.lang = 'pt-BR';
recognition.onresult = ({ results }) => {
const transcript = results[0][0].transcript;
speechSynthesis.speak(new SpeechSynthesisUtterance(transcript));
}
recognition.start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment