# Speech Recognition
aka Voice to Text API
TIP
Speech recognition is the ability of a machine or program to identify words and phrases in spoken language and convert them to a machine-readable format. Introduced in 2012 by W3C.
The HTML5 Speech Recognition API allows JavaScript to have access to a browser’s audio stream and to convert it to text.
# Examples
# Demo #1
Speech recognition example
Code
if ('SpeechRecognition' in window) {
// speech recognition API supported
} else {
// speech recognition API not supported
}
const recognition = new SpeechRecognition()
recognition.onresult = (event) => {
// What you said
console.log(event.results[0][0].transcript)
}
// Start recognition
recognition.start()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15