Skip to content
7 Steps
Sounds
People
World
Time
Verbs
Words
Grammar
Picture dictionary
Dinosaurs
Skills
Listen
Speak
Speak Intermediate
Speak Advanced
Write Advanced
Read
Dialogues
Speech Recognition2
Fast Test
7 Steps
Sounds
People
World
Time
Verbs
Words
Grammar
Picture dictionary
Dinosaurs
Skills
Listen
Speak
Speak Intermediate
Speak Advanced
Write Advanced
Read
Dialogues
Speech Recognition2
Fast Test
Search
Popular Keywords
Categories
No Record Found
View All Results
Technologies
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Y
Play
const btn_play = document.querySelector('#btn-play'); const btn_stop = document.querySelector('#btn-stop'); const resultPara = document.querySelector("#confidence"); document.getElementById('btn-stop').style.display = 'none';if(window.SpeechRecognition || window.webkitSpeechRecognition){ console.log('ok'); const API = window.SpeechRecognition || window.webkitSpeechRecognition;const recognition = new API();recognition.voiceURI = 'Google UK English Male'; recognition.lang = 'en-GB'; recognition.continuous = 'false'; recognition.onstart = function(){ console.log('Start'); };recognition.onresult= function(e){ console.log(e.results[0][0].transcript); for(const i = e.resultIndex; i = 90) { resultPara.textContent = `Confidence : ${confidence} %`; resultPara.style.background = "#04de5f"; } else { if (confidence >= 80) { resultPara.textContent = `Confidence : ${confidence} %`; resultPara.style.background = "purple"; } else { resultPara.textContent = `Confidence : ${confidence} %`; resultPara.style.background = "red"; } } //document.querySelector("#confidence").style.background = "blue"; // document.querySelector("#confidence").innerHTML = confidence + "% confidence"; document.getElementById('areatexto').innerHTML = resultado; read(resultado); }};function read(resultado){ const speech = new SpeechSynthesisUtterance(); speech.text = resultado; const allVoices = window.speechSynthesis.getVoices(); speech.voice = allVoices[1]; speech.voiceURI = 'Google UK English Male'; speech.lang = 'en-GB'; window.speechSynthesis.speak(speech); }recognition.onend=function(){ console.log('Stop button'); };btn_play.addEventListener('click',function(){ recognition.start(); document.getElementById('btn-stop').style.display="inline"; document.getElementById('btn-stop').classList.add("btn-animated"); document.getElementById('btn-play').style.display="none"; },false);btn_stop.addEventListener('click',function(){ recognition.stop();document.getElementById('btn-play').style.display="inline"; document.getElementById('btn-stop').style.display="none"; },false );}else{ console.log('error'); }
Click and type