frosty frosty - 1 year ago 159
PHP Question

Annyang converting speech to text

I'm trying to use annyang to convert speech into text, but I've ran into some problems. It works, but there's a few things that doesn't yet. First, I would like to know how would I be able to pass whatever the user said, into the alert function. Next, I would like to know how to end the annyang function when the user finished speaking. And finally, I'd like to know how to keep the allow and disallow microphone prompt from appearing again and again once it appeared once.

if (annyang) {

var commands = {
'Hello': function() {



<input type = 'submit' value = 'listen' onclick = "annyang.start();">

Answer Source

Intead of use annyang for convert to text , you could test yourself with the original google speechrecognition demo

Original Demo

See the source code of above and you will easily do what you want with SpeechRecognition

I recommend this, because annyang is more a Voice Control Plugin. By the other side you can use Artyom.js in case that you want to use a library for this.

Artyom offers an easy "dictation" object to convert speech to text quickly:

var settings = {
    continuous:true, // Don't stop never because i have https connection
        console.log("Dictation started by the user");
        alert("Dictation stopped by the user");

var UserDictation = artyom.newDictation(settings);

// Start listening

// To stop

The language needs to be providen in the initialize method.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download