Created
September 4, 2013 01:25
SpeechShim Demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | |
"http://www.w3.org/TR/html4/loose.dtd"> | |
<html> | |
<head> | |
<title>Web Speech API Demo</title> | |
</head> | |
<body> | |
<img id="audioIn" src="voice.jpg"/> | |
<div id="result"> | |
</div> | |
<script type="text/javascript" src="speechshim.js"></script> | |
<script type="text/javascript" src="speakClient.js"></script> | |
<script type="text/javascript"> | |
var audioIn = document.getElementById("audioIn"); | |
audioIn.addEventListener("click", recognize, false); | |
function recognize() { | |
var recognition = new SpeechRecognition(); | |
recognition.onresult = function(event) { | |
if (event.results.length > 0) { | |
var text = event.results[0][0].transcript; | |
document.getElementById("result").innerText = text; | |
var u = new SpeechSynthesisUtterance(); | |
u.text = text; | |
u.lang = 'en-US'; | |
speechSynthesis.speak(u); | |
} | |
}; | |
recognition.start(); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
is it possible to change the voice to a male voice?