Introduction
Introduction
<!DOCTYPE html>
<html>
<head>
<style>
/* CSS comes here*/
body {
font-family: arial;
}
button {
padding: 10px;
background-color: #6a67ce;
color: #FFFFFF;
border: 0px;
cursor: pointer;
border-radius: 5px;
}
#output {
background-color: #F9F9F9;
padding: 10px;
width: 100%;
margin-top: 20px;
line-height: 30px;
}
.hide {
display: none;
}
.show {
display: block;
}
</style>
<title>JavaScript Speech to Text
</title>
</head>
<body>
<h2>JavaScript Speech to Text
</h2>
<p>Click on the below button and speak something...</p>
<p><button type="button" onclick="runSpeechRecognition()">
Speech to Text
</button> <span id="action">
</span>
</p>
<div id="output" class="hide">
</div>
<script>
function runSpeechRecognition() {
var output = document.getElementById("output");
var action = document.getElementById("action");
var SpeechRecognition = SpeechRecognition ||
webkitSpeechRecognition;
var recognition = new SpeechRecognition();
recognition.onstart = function () {
action.innerHTML = "<small>listening, please speak...</small>";
}
recognition.onspeechend = function () {
action.innerHTML = "<small>stopped listening, hope you are
done...</small>";
recognition.stop();
}
Output :-
Conclusion :-
Refrences :-
www.firewall.cx.com
www.wikipedia.com
Objectives:
The objectives were:
Converted that told you if the speech you put in was too text
congratulated you when the text was correct.
To use Crocodile Clips correctly and learn about the different
inputs) you use.
To make sure your converted speak was correctly working through
the whole thing.
To have a correct loop that worked in the right way