npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

artyom.js

v1.0.6

Published

Artyom is a Robust Wrapper of the Google Chrome SpeechSynthesis and SpeechRecognition that allows you to create a virtual assistent

Downloads

1,359

Readme

Table of Contents

About Artyom

Artyom.js is a robust and useful wrapper of the webkitSpeechRecognition and speechSynthesis APIs. Besides, artyom allows you to add dynamic commands to your web app (website).

Artyom is constantly updated with new gadgets and awesome features, so be sure to star and watch this repository to be aware of any update. The main features of Artyom are:

Speech Recognition

  • Quick recognition of voice commands.
  • Add commands easily.
  • Smart commands (usage of wildcards and regular expressions).
  • Create a dictation object to convert voice to text easily.
  • Simulate commands without microphone.
  • Execution keyword to execute a command immediately after the use of the keyword.
  • Pause and resume command recognition.
  • Artyom has available the soundex algorithm to increase the accuracy of the recognition of commands (disabled by default).
  • Use a remote command processor service instead of local processing with Javascript.
  • Works both in desktop browser and mobile device.

Voice Synthesis

  • Synthesize extreme huge blocks of text (+20K words according to the last test).
  • onStart and onEnd callbacks will be always executed independently of the text length.
  • Works both in desktop browser and mobile device.

Read the changelog to be informed about changes and additions in Artyom.js

Installation

NPM

npm install artyom.js

Bower

bower install artyom.js

Or just download a .zip package with the source code, minified file and commands examples : download .zip file

How to use

Artyom is totally written in TypeScript, but it's transpiled on every version to JavaScript. 2 files are built namely artyom.js (used with Bundlers like Webpack, Browserify etc.) and artyom.window.js (only for the web browser). As everyone seems to use a bundler nowadays, for the module loader used is CommonJS:

// Using the /build/artyom.js file
import Artyom from './artyom.js';

const Jarvis = new Artyom();

Jarvis.say("Hello World !");

Alternatively, if you are of the old school and just want to use it with a script tag, you will need to use the artyom.window.js file instead:

<script src="artyom.window.js"></script>
<script>
    var Jarvis = new Artyom();

    Jarvis.say("Hello World !");
</script>

The source code of artyom handles a single TypeScript file /source/artyom.ts.

Basic usage

Writing code with artyom is very simple:


// With ES6,TypeScript etc
import Artyom from './artyom.js';

// Create a variable that stores your instance
const artyom = new Artyom();

// Or if you are using it in the browser
// var artyom = new Artyom();// or `new window.Artyom()`

// Add command (Short code artisan way)
artyom.on(['Good morning','Good afternoon']).then((i) => {
    switch (i) {
        case 0:
            artyom.say("Good morning, how are you?");
        break;
        case 1:
            artyom.say("Good afternoon, how are you?");
        break;            
    }
});

// Smart command (Short code artisan way), set the second parameter of .on to true
artyom.on(['Repeat after me *'] , true).then((i,wildcard) => {
    artyom.say("You've said : " + wildcard);
});

// or add some commandsDemostrations in the normal way
artyom.addCommands([
    {
        indexes: ['Hello','Hi','is someone there'],
        action: (i) => {
            artyom.say("Hello, it's me");
        }
    },
    {
        indexes: ['Repeat after me *'],
        smart:true,
        action: (i,wildcard) => {
            artyom.say("You've said : "+ wildcard);
        }
    },
    // The smart commands support regular expressions
    {
        indexes: [/Good Morning/i],
        smart:true,
        action: (i,wildcard) => {
            artyom.say("You've said : "+ wildcard);
        }
    },
    {
        indexes: ['shut down yourself'],
        action: (i,wildcard) => {
            artyom.fatality().then(() => {
                console.log("Artyom succesfully stopped");
            });
        }
    },
]);

// Start the commands !
artyom.initialize({
    lang: "en-GB", // GreatBritain english
    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" 
}).then(() => {
    console.log("Artyom has been succesfully initialized");
}).catch((err) => {
    console.error("Artyom couldn't be initialized: ", err);
});

/**
 * To speech text
 */
artyom.say("Hello, this is a demo text. The next text will be spoken in Spanish",{
    onStart: () => {
        console.log("Reading ...");
    },
    onEnd: () => {
        console.log("No more text to talk");

        // Force the language of a single speechSynthesis
        artyom.say("Hola, esto está en Español", {
            lang:"es-ES"
        });
    }
});

All you need to know about Artyom

Do not hesitate to create a ticket on the issues area of the Github repository for any question, problem or inconvenient that you may have about artyom.

Development

Building Artyom from source

On every update, we build the latest version that can be retrieved from /build (for the browser and module). However, if you are willing to create your own version of Artyom, you would just need to modify the source file /source/artyom.ts and generate the build files using the following commands.

If you want to create the Browser version, you will need as first remove the export default keywords at the beginning of the class and run then the following command:

npm run build-artyom-window

If you want to create the Module version with CommonJS (for webpack, browserify etc) just run:

npm run build-artyom-module

Testing

If you're interested in modify, work with Artyom or you just simply want to test it quickly in your environment we recommend you to use the little Sandbox utility of Artyom. Using Webpack the Artyom Sandbox creates an HTTPS server accessible at https://localhost:3000, here artyom will be accesible in Continuous mode too.

Start by cloning the repository of artyom:

git clone https://github.com/sdkcarlos/artyom.js/
cd artyom.js

Switch to the sandbox directory:

cd sandbox

Then install the dependencies:

npm install

And start the Webpack dev server using:

npm start

and finally access to the https://localhost:3000 address from your browser and you will see a little UI interface to interact with Artyom. This is only meant to work on Artyom, so it still in development.

Languages

Artyom provides complete support for the following languages. Every language needs an initialization code that needs to be provided in the lang property at the initialization.

| |Description |Code for initialization| ------------- | ------------- | ------------- | || English (USA)English (Great Britain) Great Britain| en-USen-GB | || Español | es-ES | || Deutsch (German) | de-DE | | | Italiano |it-IT | | | Français |fr-FR | | | Japanese 日本人 | ja-JP | | | Russian | ru-RU | | | Brazil | pt-PT | | | Dutch (netherlands)| nl-NL | | | Polski (polonia)| pl-PL | | | Indonesian (Indonesia)| id-ID | | | Chinese (Cantonese[ 粤語(香港)] Mandarin[普通话(中国大陆)])| Cantonesezh-HK Mandarinzh-CN| || Hindi (India) | hi-IN |

Demonstrations

Thanks

Working with artyom is cool and easy, read the documentation to discover more awesome features.

Thanks for visit the repository !