Monday, June 3, 2024
31
rated 0 times [  35] [ 4]  / answers: 1 / hits: 18726  / 8 Years ago, fri, august 5, 2016, 12:00:00

In documentation and tutorial for REST API (Google Sppech API for Node: https://cloud.google.com/nodejs/apis), so my question is how to use the Cloud Speech API in JavaScript. Someone used on any page with javascript?






2020-04-24 EDIT: The accepted answer is using webkitSpeechRecognition which is not available on mobile: https://stackoverflow.com/a/61039699/775359



Google documentation and examples: https://cloud.google.com/speech-to-text/docs/samples



Node.js code: https://github.com/googleapis/nodejs-speech/blob/master/samples/MicrophoneStream.js



REQUIREMENT: it has to run in Safari on iOS.


More From » speech-recognition

 Answers
17

The Google Cloud API is more specifically used for server-side speech processing. If you're looking to use voice recognition through a browser, you should use your browser's built in Web Speech API. Here's a simple example:





var recognition = new webkitSpeechRecognition();
recognition.continuous = true;

var output = document.getElementById('output');
recognition.onresult = function(event) {
output.textContent = event.results[0][0].transcript;
};

<div id=output></div>
<button onclick=recognition.start()>Start</button>
<button onclick=recognition.stop()>Stop</button>




[#61137] Wednesday, August 3, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
uriahw

Total Points: 372
Total Questions: 93
Total Answers: 115

Location: Bahrain
Member since Fri, Sep 16, 2022
2 Years ago
;