Skip to content

Instantly share code, notes, and snippets.

@ignitz
Created January 20, 2020 13:41
Show Gist options
  • Save ignitz/23a15ac06dc80838d70a0dcb5b4548cb to your computer and use it in GitHub Desktop.
Save ignitz/23a15ac06dc80838d70a0dcb5b4548cb to your computer and use it in GitHub Desktop.
Browser voice engine example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=100%, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
</head>
<body>
<script>
function playAudio() {
var msg = new SpeechSynthesisUtterance("Marcola!");
msg.lang = "pt-BR";
window.speechSynthesis.speak(msg);
}
</script>
<button id="runProgram" onclick="playAudio();" class="runProgram-button">
Clica aqui!
</button>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment