Coder Social home page Coder Social logo

sdkcarlos / artyom.js Goto Github PK

View Code? Open in Web Editor NEW
1.2K 74.0 371.0 1.11 MB

A voice control - voice commands - speech recognition and speech synthesis javascript library. Create your own siri,google now or cortana with Google Chrome within your website.

Home Page: http://sdkcarlos.github.io/sites/artyom.html

License: MIT License

JavaScript 59.53% HTML 0.19% TypeScript 40.25% CSS 0.04%
voice-commands speech-recognition recognition speech-synthesis speech-to-text

artyom.js's Introduction

artyom.js's People

Contributors

mamewotoko avatar sdkcarlos avatar semagarcia avatar vikaskedia avatar vivianlink avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

artyom.js's Issues

Artyom with express

Hi, I'm trying to use artyom in a express nods app. I added with the following command (inside the project folders)

npm install artyom.js

And I see it in node_modules. In app.js I add the following lines:

var artyom = require('artyom.js/build/artyom.js');
const jarvis = new Artyom();

but when I start the app I got the following error:

const jarvis = new Artyom();
ReferenceError: Artyom is not defined

Any idea why? Thanks
4b

artyom.d.ts index file out of date

It seems this file was last updated for 1.0.3. It is out of sync with the actual code. For example the index.d.ts file says:

        /**
         * Set up artyom for the application. This function will set the default language used by artyom
         * or notice the user if artyom is not supported in the actual browser.
         * @see http://docs.ourcodeworld.com/projects/artyom-js/documentation/methods/initialize
         * @param {ArtyomConfigProperties} config
         * @returns {Boolean}
         */
        initialize(config: ArtyomConfigProperties): boolean;

however, it seems to instead return a promise when printing it out in a web console.

Passing wildcard through Ajax

$.ajax({
            url: 'CommandService.asmx/getCommands',
            method: 'POST',
            dataType: 'json',
            async: false,      
            success: function (commands) {
                $.each(commands, function (i, command) {
                    if (command.Command.indexOf('*') >= 0) {
                        commands[j] = {
                            smart: true,
                            indexes: [command.Command], // These spoken words will trigger the execution of the command
                            action: function (wildcard) { // Action to be executed when a index match with spoken word

                                window.open(command.Action + wildcard.tostring()); //showSpecificEmp.aspx?P=*
                                artyom.say(command.SayWhat);

                            }
                        };
                    }
                    else {
                        commands[j] = {
                            smart: false,
                            indexes: [command.Command], // These spoken words will trigger the execution of the command
                            action: function () { // Action to be executed when a index match with spoken word

                                window.open(command.Action);

                            }
                        };
                    }

                    artyom.addCommands(commands[j]); // Add the command with addCommands method. Now
                    j++;
                });
                artyom.initialize({
                   lang: "en-GB",// More languages are documented in the library
                    continuous: true,//if you have https connection, you can activate continuous mode
                    debug: true,//Show everything in the console
                    listen: true // Start listening when this function is triggered
                });
            },
            error: function (xhr, status, error) {
                alert(error);
            }
        });

I have this code I would like to implement. I already have the JSON. However, the wildcard always stays with the value "0". Why?

How long does a microphone work in Chrome Android?

With prolonged use, it stops without any error. Just after reading fades out

  1. Is it possible to have some kind of work time? How long can it work inclusive?
  2. How to remove a country sound on a mobile device Turning off the microphone

When setting new language and restart in continous mode it gives error

Hello, when i'm trying to set the language, i stop artyom and the i reinitiliaze it with the new language but it gives me an error. here is my code.

function start(language){
if(language){ language = language; } else { language = artyom.getLanguage(); }
artyom.initialize({
lang: language,// A lot of languages are supported. Read the docs !
continuous:true,// Artyom will listen forever
listen:true, // Start recognizing
debug:true, // Show everything in the console
speed:1, // talk normally
executionKeyword: "now"
});
if(artyom.isRecognizing()){
console.log("Artyom is listening to your commands");
} else {
console.log("Artyom is not listening to you.");
}
}

{
indexes:["switch to italian","switch to german","switch to french","switch to spanish","switch to portuguese","switch to dutch","switch to polish","switch to indonesian","switch to english"],
action: function(i){
switch(i){
case 0: stop(); start("it"); break;
case 1: start("de"); break;
case 2: start("fr"); break;
case 3: start("es"); break;
case 4: start("pt"); break;
case 5: start("nl"); break;
case 6: start("pl"); break;
case 7: start("id"); break;
case 8: start("en-GB"); break;
}
}
}

Regex commands

It'd be cool if we could use Regex's to make our commands more natural / smart.

Chromebit language issue

Hi there. I found an issue when trying to use this library with my Asus Chromebit. Even when I set the language to "en" or "en-US" in the initialize function, the Chromebit would still speak German. It looks like it's probably related to this issue (http://stackoverflow.com/questions/28219465/is-chrome-os-german-the-correct-default-voice-on-chrome-os)

I ended up forking the library and hardcoding msg.lang to be "en" and that seemed to fix it. I'm not sure how you might fix that in the library to account for the variability.

related to recognition speed

i am working with basic JavaScript model it works fine . but the recognition speed is slow .is there any way to increase recognition speed

Not work Text to Speech EDGE

the voice does not work on the main page.
When you enter, you have to say something.
Also, all examples of who should be silent
I think it's a bug in the code. Let me know if I'm wrong

Edge problem

Can't distinguish between words that sound the same

I'm trying to use artyom.addCommands to listen to voice and trigger different keystrokes on a digital keyboard. Artyom has trouble distinguishing between "four" and "for", "C" and "see", etc. I've tried several ways to work around this, am I just missing a way to train it?

[Feature Request] Recognizing when artyom is not obeying.

Hi,
I'm using Artyom with a "obeyKeyword" and I enable the command recognition when the obeyKeyword is spoken in my project

I would like to know if Artyom is recognizing some text when "obey" is disabled. I tried to use "TEXT_RECOGNIZED" but this event is only triggered when "Obey" is enabled.

To get this funcionality I create a event "NOT_TEXT_RECOGNIZED" on the artyom's code.

Are there anotherway to know if artyom is recogninzing some text when artyom is not obeying?

Code alteraded:

     reconocimiento.onresult = function(event){
            if(artyomProperties.obeying){
                onResultProcessor(event);
            }else{
                // Handle obeyKeyword if exists and artyom is not obeying
                if(!artyomProperties.obeyKeyword){
                    return;
                }

                var temporal = "";
                var interim = "";

                for (var i = 0; i < event.results.length; ++i) {
                    if (event.results[i].final) {
                        temporal += event.results[i][0].transcript;
                    } else {
                        interim += event.results[i][0].transcript;
                    }
                    
                    /////////////////////////////////////////////////////////////
                    

                    artyom_triggerEvent('NOT_TEXT_RECOGNIZED', {
                        result:  event.results[i][0].transcript,
                        final: event.results[i].isFinal
                    });

                   
                    /////////////////////////////////////////////////////////////

                }

                artyom.debug("Artyom is not obeying","warn");

                // If the obeyKeyword is found in the recognized text
                // enable command recognition again
                if(((interim).indexOf(artyomProperties.obeyKeyword) > -1) || (temporal).indexOf(artyomProperties.obeyKeyword) > -1){
                    artyomProperties.obeying = true;
                }
            }

}

Chromium support?

Hi there, does anyone know if this library is supported for Chromium?

Incorrect "main" parameter in package.json

When installing this library using npm, it fails to compile with the error "module not found". It would seem that this is caused by the fact that the "main" parameter in package.json is set to "artyom.js" rather than "build/artyom.js". I've tested this change on my computer and it solves the issue for me.

Loop in React

If i use your excellent package in React, i get a loop when i spoke a phrase. How can i fix that?

componentDidMount() {
    const assistent = new Artyom();
    assistent.addCommands([
      {
        indexes: ['Buenos días'],
        action: (i) => {
          assistent.say("Buenos días. ¿Como amaneciste?")
        }
      },
      {
        indexes: ['Buenas tardes'],
        action: (i) => {
          assistent.say("Buenas tardes. ¿Como ha estado tu día?")
        }
      }
    ])
  
    assistent.initialize({
      lang: "es-ES",
      continuous: true, // Listen forever
      soundex: true,// Use the soundex algorithm to increase accuracy
      debug: true, // Show messages in the console
      // executionKeyword: "and do it now",
      listen: true, // Start to listen commands !
  
      // If providen, you can only trigger a command if you say its name
      // e.g to trigger Good Morning, you need to say "Jarvis Good Morning"
      // name: "Jarvis" 
    })
  }

If i say "Buenos días" the browser answer "Buenos días. ¿Como amaneciste?" in a loop (never ends). How can i fix that issue? I think you need to delete the request after the system spoke

Thanks

Turkish support

Hey dude, it seems you have done a brilliant job there. But i need turkish support, especially for speech-to-text side (webkitSpeechRecog).
What actually do you need about it? It seems you are wrapping webkitSpeechRecognition so that, when i pass language code as "tr-TR" it should work well. But when it comes to speechSynthesis ?

artyom is recognizing the text which spoken by itself

While artyom speaks, it is also recognizing the text spoken by itself. I tried to stop/start obeying while it speaks, but it is not working as expected. Is there any way to stop listening while artyom speaks?

window.artyom.say(msg, {
    onStart() {
      window.artyom.dontObey();
    },
    onEnd() {
      window.artyom.obey();
    },
  });

Continuous mode enabled, restarting bug in Artyom

Good day,

I am using the Artyom 1.0.6 version. When I'm initializing the script. it always prints at the console the message, " Continuous mode enabled," and suddenly my machine hangs because of the instance.

let check = () => {
gieselle.initialize({
lang:"en-GB",
continuous:true,
debug:true,
listen:true
}).then(() => {
gieselle.say("Hello, I'm Gieselle. Your Virtual Travel Buddy");
}).catch((err) => {
gieselle.say("I couldn't be initialized, please check the console for errors");
console.log(err);
});
};
check();

event.results[i].final

Hi,
I was checcking for the code and I found this propertie "event.results[i].final" like "undefined".
Shouldn't it be "event.results[i].isFinal"?
Best regard,

Artyom.newDictation is not a function

when i do

var UserDictation = Artyom.newDictation({
        continuous: true, // Don't stop never because i have https connection
        onResult: function (text) {
            /**
             * Set the recognized text as value of the text input
            **/
        },
        onStart: function () {
            console.log("Dictation started by the user");
        },
        onEnd: function () {
            alert("Dictation stopped by the user");
        }
    });

I get :/

Uncaught TypeError: Artyom.newDictation is not a function

chrome is not allowed to use the microphone

I have a project that worked until months ago, but suddenly the chromer started not giving permission to use the microphone. I entered the chromer configuration to see if the url was in the blocked microphone addresses, but it was not. Can anyone help?

Stop/pause recognize command

Needed the ability to stop/pause voice recognition. During speaking artyom recognizes it's own voice as command and I'd like to stop recognition while he speaks. command to have the ability to stop/resume only recognition. In my environment (artyom is configured to talk on app status change) if I stop artyom (fatality) he continues speaking (and thats ok) but with default language (english). It could be also usefull a configurable wakeup command, just to avoid false positive recognize.
Thanks

Chrome extension - verify microphone

error_artyom
Hey there,

I am building a chrome extension using the voice input of the users and processing them with artyom.js, but in the console, there always occurs the error "Verify the microphone... " in the artyom.window.min.js file.
Is there a possibility to get the User Voice Input or does anybody know how to Bypass this Problem?

Thanks in advance :)

Doesnt work in Firefox

I have one issue
1.This plug in is not working in mozilla firefox ,is there any way to resolve this issue.

Problem with smart commands with wildcard in the end

var command = {
   indexes:["Hello *"],
   smart:true,
   action: function(i,wildcard){
    // if you decide to say Hello good morning dear imaginary person this is a long text
    // the wildcard should be : good morning dear imaginary person this is a long text
     console.log(wildcard); // isntead the recognized wildcard is good morning and the commands stops.
   }
};

artyom.addCommands(command);`

Refine the mode in which the smart commands are being processed.

artyom.newDictation

Is there a way to check the incoming sound levels while using

  var UserDictation = artyom.newDictation({
      continuous:true, // Enable continuous if HTTPS connection
      onResult:function(text){

The goal being that it listens continously for a sentence, once it has received a bunch of inputs, pauses and can execute some functions when there is no input and then restarts the listening after a short interval.

[QUESTION] Nested events.

Hey, first of all, great job on this.

My question if is there already available something to nested functions or events, per example when you say something the function trigger a new command and stay in this function till we finish. Like a while or if statement but with artyon events.

Code example:

screen shot 2017-07-02 at 20 06 40

Thank you.

[Feature Request] preferences for the voice

The current model will use the first match of voiceIdentifiersArray and speechSynthesis.getVoices().

It will be really handy if the users can have some control over the voice.

Something like user-defined preferences list. Check whether the voice in the list is available one by one, and failback to first match strategy if no match.

In initialization:

artyom.initialize({
    lang: "en-US", // US english
    speed: 1,
    debug: true, // Show messages in the console
    voice: ['Google US English', 'Alex'],
});

and able to change the voice when calling artyom.say()

I can do a PR if you don't have the time.

Cant get it to work in Opera or Firefox

Hi there,

Is this only restricted to chrome ? In firefox there is an error when initialising, in Opera it initialises fine, but info about using a microphone never pops up to give access, hence no voice commands work there.

Other than that awesome job!

return false for non supported browsers

I load the library by default for different distributions, had to make a change so the library does not cause errors.

Would this be valid for a PR ?

    if (window.hasOwnProperty('speechSynthesis')) {
        speechSynthesis.getVoices();
    } else {
        console.error('this browser does not support speechSyntesis');
        return false;
    }

    if (window.hasOwnProperty('webkitSpeechRecognition')) {
        var reconocimiento = new webkitSpeechRecognition();
    } else {
        console.error('this browser does not support webkitSpeechRecognition');
        return false;
    }

Related to multiple speech recognition on mobile browser

Hi,
Artyom work perfectly fine on desktop browser, but when tried using mobile browser, it take input multiple times. Can u please suggest a workaround for this issue ?

Eg.) If input is "What was my sales in 2017"
Artyom gives : What What What was was was my my my sales sales sales 2017 2017 2017

Same code is deployed at both places.

This issue is there only for mobile browser(maybe due to multiple microphones being available on mobiles nowdays)

Speech recognition stops after executing command

Hi,
i am playing with the library , but had problem that when the speech matches a command it execute that command and stops , in the console it writes


Artyom.js:  << Executing Matching Recognition in normal mode >>
sentence accepted
VM774:12  Artyom.js   1 text chunk processed succesfully out of 1

my settings
"artyom.js": "^1.0.5",
i am using it with angular2 component

    if (artyom)
    {

      artyom.initialize({
                          lang:"en-GB",
                          debug:true, // Show what recognizes in the Console
                          listen:false, // Start listening after this
                          speed:0.9, // Talk a little bit slow
                          mode:"normal", // This parameter is not required as it will be normal by default
                          listen: true // Start to listen commands !
                        });
 artyom.addCommands([
                         {
                           indexes : ["execute *","listen *","robot *"] ,
                           smart:true,
                           action : (i,wildcard)=>
                           {
                             console.log("sentence accepted");
                             this.sentenceText =wildcard;
                             artyom.say("You said : "+wildcard);
                           }
                         } 
                       ]);
    }

so what could be the reason for it ? and how to fix it so it take the next command ?

I've couldn't use the Library

Hello,
I've just installed the library, but I'm getting : artyom.say is not a function

var artyom= require ('artyom.js');
 artyom.say('hi');

Am I doing something wrong ?

Text is getting cleared from TextArea once assigned under OnResult

var settings = {
continuous: true, // Don't stop never because i have https connection
onResult: function (text) {
document.getElementById('btn-input').value = text;
},
onStart: function () {
alert("Dictation started by the user");
},
onEnd: function () {
alert("Dictation stopped by the user");
//document.getElementById('btn-input').value = buffer;
}
};

For above i am able to see the text converted from speech into the textarea, but getting cleared once speech ends.

Not sure where to place the output text dictation on the html body

Hi there, I have followed the instructions and looked into the demos but I still haven't been able to get it working. I know the microphone is working, the red dot fires, and I can't quite tell what I am doing wrong. i have used another voice recognition library so I am familiar with the basics.

I think what's missing is that on your tutorials you don't mention the text output code or area; I looked into the page sources and I found something but it doesn't work either...I am new to Javascript so there must be something I am missing:)
Btw I am NOT using artyom.js for voice commands, ONLY for dictation.

here's what I have [html]:

  1. The two buttons that activate and deactivate
<input class="buttonRoundVoiceToTextWhite" type="button" onclick="startRecognition();" value="Recognize text" />
  <input class="buttonRoundVoiceToTextBlue hidden" type="button" onclick="stopRecognition();" value="stop recognition" />

  1. the area (text input) where the text would go:
    <input id="artyom-redirect-output" type="text" name="lastname">
    //I also tried adding a span instead of the text input but that did not work either...
  2. The full script with the artyom code, including some unrelated jquery code that works around these buttons to show and hide elements
<script>

$(".buttonRoundVoiceToAnimWhite").click(function() {
  $(".buttonRoundVoiceToAnimBlue").show();
    $(".buttonRoundVoiceToAnimWhite").hide();

});

$(".buttonRoundVoiceToAnimBlue").click(function() {
  $(".buttonRoundVoiceToAnimWhite").show();
    $(".buttonRoundVoiceToAnimBlue").hide();

});

$(".buttonRoundVoiceToTextWhite").click(function() {
  $(".buttonRoundVoiceToTextBlue").show();
    $(".buttonRoundVoiceToTextWhite").hide();

});

$(".buttonRoundVoiceToTextBlue").click(function() {
  $(".buttonRoundVoiceToTextWhite").show();
    $(".buttonRoundVoiceToTextBlue").hide();

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


var UserDictation = artyom.newDictation(settings);

function startRecognition(){
  UserDictation.start();
}

function stopRecognition(){
  UserDictation.stop();
}


artyom.redirectRecognizedTextOutput(function(recognized,isFinal){
    if(isFinal){
        console.log("Final recognized text: " + recognized);
    }else{
        console.log(recognized);
    }
});

//end of artyom



</script>

and I have this in the header:

<script src="artyom.min.js"></script>

I would appreciate any pointers:) I am really interested in testing multiple languages, but first I want to make sure the basic stuff works:)
THANK YOU!

Problem removeCommands

artyom.removeCommands("Hello"); - artyom.removeCommands is not a function
The function does not work the question is it's just me having such a problem ??

Load a new command in case that it doesn't exists

`let artyom = new Artyom();

// Some code that adds commands

var commands = artyom.getAvailableCommands();

for(var i = 0;i < commands.length;i++){
var command = comanddos[i];

// If NOT exists a command triggered by hello, add it . 
if(!command.indexOf("hello")){
    artyom.addCommands([
        {
            description:"Says hello to the user",
            indexes:["hello","whats up"],
            action:function(){
                artyom.say("Hey what's your budget");
            }
        }
    ]);

    break;//Stop search in commands
}

}

// Now we can say hello !`

Also the code is not working

** comanddos[i]** - no variable
I write the code when new commands arrive. Old teams that match should be deleted (But not all)
Only those who have a coincidence with the new

[QUESTION] Use especific word to initialize commands?

It is possible?

Define one word to initialize commands.

var word_init_comma = "orange"; // ok... sorry my poor example :P 

This word possible uses: app name, website name, ...

artyom.addCommands([
{
    indexes: [word_init_comma + " open contacts"],
    action: function(i){
        console.log("function for open contacts html fragment!");
    }
},
{
    indexes: [word_init_comma + " send message"],
    action: function(i){
        console.log("function to send message");
    }
}
]);

// or use in source property (if possible add personality command constructor)
artyom.initialize({
  lang:"en-US",
  continuous:true,
  debug:false, // Show what recognizes in the Console
  listen:true, // Start listening after this
  speed:0.9, // Talk a little bit slow
  //mode:"normal", // This parameter is not required as it will be normal by default
  word_init_comma: "orange"
});

// usage (by voice command) like:  orange open contacts

Male vs Female

When I get a list of my voices I see "English UK Male" and "English UK Female" ... how do I get Artyom to use the English UK Female voice?

pt-PT is not Brazil's language correct ISO code

On your readme and docs, you got pt-PT as for Brazil's language. In fact, pt-PT code stands for Portuguese from Portugal, and pt-BR code stands for Portuguese from Brazil.

Portuguese is the native language of:

  • PORTUGAL - pt-PT
  • ANGOLA - pt-AO
  • BRAZIL - pt-BR
  • MOZAMBIQU - pt-MZ
  • GUINEA-BISSAU - don't know
  • CAPE VERDE - don't know
  • SÃO TOMÉ E PRÍNCIPE - pt-ST

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.