mercredi 13 juillet 2016

Voice response based on given voice input

I'm trying to get a voice based response for my web app. For this I have Googled and found the Annyang! Javascript library. Wiht the help of this library I was able to alert some message based on the voice command given by the user.

But anyone can please help me how can I get a voice response instead of UI response for a given user voice input?

Here is the code I'm using for getting a UI response for given voice commands.

<script>
$(document).ready(function(){
    if (annyang) {
        var commands = {
            'I am *name': function(name) {
               alert('Hello! '+ name + ' Please try saying "tell me your address"');          

            },

            'Tell me your address': function() {
              alert('Hey, we are at hyderabad kavuri hills. Should I mail it for you?');
              alert('Should I mail it for you?');
            },


            'yes': function(){
             alert('Please tell your mail id');
            },

            'my email is *email': function(email){
              alert('Mail has been sent to " +email)  
              alert('Okay, Thank you for visiting!')
            }

        };

        annyang.addCommands(commands);
        annyang.debug();
        annyang.start(); 
    }
});
</script>

Aucun commentaire:

Enregistrer un commentaire