Skip to content

Instantly share code, notes, and snippets.

@strongSoda
Created December 22, 2019 06:57
Show Gist options
  • Save strongSoda/27f4caf1335e3d03accf708e1fcdcbf0 to your computer and use it in GitHub Desktop.
Save strongSoda/27f4caf1335e3d03accf708e1fcdcbf0 to your computer and use it in GitHub Desktop.
<!-- Code for tutorial: https://www.youtube.com/watch?v=4eIRrowvLRk -->
<!-- DevHoot Publication -->
<!-- Website: https://devhoot.ooo -->
<!-- Note: This code was produced by Imran Khan @DevHoot -->
<!-- If you find this useful consider subscribing to our YouTube channel and website -->
<!-- patreon Support: https://www.patreon.com/devhoot -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<!-- Input area -->
<label for="Speech Recognition">Speech Recognition</label>
<input type="text" name="" id="speechToText" placeholder="Speak Something" onclick="record()">
<!-- Below is the script for voice recognition and conversion to text-->
<script>
function record() {
var recognition = new webkitSpeechRecognition();
recognition.lang = "en-GB";
recognition.onresult = function(event) {
// console.log(event);
document.getElementById('speechToText').value = event.results[0][0].transcript;
}
recognition.start();
}
</script>
<!-- end of script -->
</body>
</html>
@Rohith1221
Copy link

hey! this is not working with textareas? Any idea why?

It does work , recheck the textarea id

@nflnsr
Copy link

nflnsr commented Jul 8, 2022

thank youuu :)

@m-alaiady
Copy link

Well done! it works as expected :)

@macbench
Copy link

macbench commented Sep 4, 2023

Awesome dude

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment