1var msg = new SpeechSynthesisUtterance();
2msg.text = "Hello World";
3window.speechSynthesis.speak(msg);
1function readOutLoud(message) {
2 var speech = new SpeechSynthesisUtterance();
3
4 // Set the text and voice attributes.
5 speech.text = message;
6 speech.volume = 1;
7 speech.rate = 1;
8 speech.pitch = 1;
9
10 window.speechSynthesis.speak(speech);
11}
1$('#start-record-btn').on('click', function(e) {
2 recognition.start();
3});
1recognition.onresult = function(event) {
2
3 // event is a SpeechRecognitionEvent object.
4 // It holds all the lines we have captured so far.
5 // We only need the current one.
6 var current = event.resultIndex;
7
8 // Get a transcript of what was said.
9 var transcript = event.results[current][0].transcript;
10
11 // Add the current transcript to the contents of our Note.
12 noteContent += transcript;
13 noteTextarea.val(noteContent);
14}
1var mobileRepeatBug = (current == 1 && transcript == event.results[0][0].transcript);
2
3if(!mobileRepeatBug) {
4 noteContent += transcript;
5 noteTextarea.val(noteContent);
6}