Coder Social home page Coder Social logo

Comments (3)

sdkcarlos avatar sdkcarlos commented on May 10, 2024

Hey @fraschizzato i'm working on it but i see that the pause function (use .fatality to stop) may not work properly according to how you use it.

Please, download the dev-nodownload version of artyom and test what you want to achieve using the new methods. I don't want to publish the 0.9.7 version yet, so if you want to test it quick download the dev-nodownload please here.

New methods :

  • artyom.obey : enable the command recognition if disabled.
  • artyom.dontObey : disable the command recognition (not speechRecognition) dinamically.
  • artyom.initialize (new property) : obeyKeyword property. If the command recognition is disabled with the dontObey method, it will be automatically enabled if you say the obeyKeyword while the command recognition is disabled (the suggested wakeUp command).

This will be published in the next version.

// add the hello commands
artyom.addCommands({
    indexes: ["Hello"],
    action: function(i){
        console.log("Hey, i just said hello ... or maybe was the computer, snap!");
    }
});

// Start artyom how you always do ..
// But if you want the "wake up command"
// if artyom is not obeying, use the obeyKeyword property
artyom.initialize({
    lang:"en-GB",
    continuous:true,
    debug:true,
    listen:true,
    // if artyom is not obeying (paused) and the users says the obeyKeyword
    // it will continue with the command recognition (obey again)
    // if you say "start again" and artyom is not obeying, it will obey again.
    obeyKeyword: "start again"
});

// Talk something that may match with hello command
// Change the text with something of yours
artyom.say("Hello this message would normally match with a command.",{
    onStart:function(){
        // Don't obey any command
        artyom.dontObey();
    },
    onEnd: function(){
        setTimeout(function(){
            // Allow to process commands again
            artyom.obey();
        },2000);// wait 2 seconds
    }
});

However there are 2 behaviours that you need to know, if you're talking about "pause" that means
the recognition needs to be "active", therefore it will keep recognizing text till its end (unless you cancel or restart it).
That will cause that the onResult event of the speechRecognition will keep the text previously recognized
(even if artyomRecognition is paused) and it will processed again, triggering pitifully your command although it is paused.

Although what you want is difficult to achieve because the webkitSpeechRecognition cannot be paused (only methods : abort, start and stop), the processing can be
temporary paused while you use artyom.say using the onStart and onEnd callbacks.

If someone speaks after the onEnd callback, then it is most likely to keep saving the previous spoken text and it will fail.

Note : this works only in "normal" mode of artyom, with "quick" is not possible even without the timeout.

A simple solution would be to stop artyom when artyom says something and initialize it again (using timeout) because there's no other solution when you work in noisy environments (only with headphones would work :( ).

from artyom.js.

fraschizzato avatar fraschizzato commented on May 10, 2024

Perfect, thanks

from artyom.js.

sdkcarlos avatar sdkcarlos commented on May 10, 2024

Function is now available since artyom 0.9.7 and the remote mode.

from artyom.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.