Skip to content

Instantly share code, notes, and snippets.

@meru-akimbo
Created June 19, 2012 11:44
Show Gist options
  • Save meru-akimbo/2953685 to your computer and use it in GitHub Desktop.
Save meru-akimbo/2953685 to your computer and use it in GitHub Desktop.
html5の音声認識を用いたspeaking test
<html lang="en">
<head>
<meta charset="utf-8">
<title>speech test</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
function speechInput() {
var test = $("#get_voice").val();
if(test.match(/my name is/)){
alert("good! because include 'my name is'");
}else{
alert("bad! because not include 'my name is'");
}
}
</script>
</head>
<body>
<h1>What your name?</h1>
<input id="get_voice" type="text" x-webkit-speech onwebkitspeechchange="speechInput();" />
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment