- About Artyom
- Installation
- Development
- Languages
- All you need to know about Artyom
- Demonstrations
- Basic usage
- Thank-you note
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, star and watch this repository to be aware of artyom updates.
The most known features of artyom are:
- Quick recognition of voice commands.
- Add commands easily.
- Smart commands (usage of wildcards).
- 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.
- 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
npm install artyom.js
bower install artyom.js
Or just download a .zip package with the source code, minified file and commands examples : download .zip file
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 Node.js the Artyom Sandbox creates an HTTPS server accessible at https://localhost:8443, 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
Install the dependencies:
npm install
If you only want to test Artyom.js, then you can simply navigate to the /development
folder and execute:
cd development
node server.js
If you are interested in programming with Artyom, then you need to install nodemon globally using:
npm install -g nodemon
Nodemon will restart the server automatically everytime you make changes in Artyom or any file inside /development
. Then start the sandbox using:
npm run sandbox
With any of the previous methods, navigate to https://localhost:8443
and explore artyom in your browser. You can directly debug the sandbox from mobile devices in the Local Area Network (read this article for more information).
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.
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.
Artyom it's written in Vanilla JS and TypeScript (Angular2):
Artyom is built from plain JavaScript (old-fashion way), where all logic is wrapped with an IIFE without any module loader. Example of use with JavaScript:
// 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);
}
}
]);
// 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 !
}).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"
});
}
});
Artyom is also written in TypeScript (.js transpiled from .ts + its definition file -.d.ts) in order to improve the performance in some parts of the library. In that case, the module loader used is CommonJS. Example of use with Angular2 & TypeScript:
import * as Artyom from 'artyom.js';
let artyom = Artyom.ArtyomBuilder.getInstance();
// Add a command (not smart)
artyom.addCommands({
description: 'Test command',
indexes: ['hello', 'hi'],
action: (i) => {
console.log('hello action');
}
});
or
import { ArtyomBuilder } from 'artyom.js';
let artyom = ArtyomBuilder.getInstance();
// Add a smart command
artyom.addCommands({
description: 'Test command 2',
smart: true,
indexes: ['test *'],
action: (i, wildcard) => {
console.log('wildcard: ', wildcard);
}
});
Ather that import, you can follow the rest of the snippet in the previous section (artyom.addCommands({...}, artyom.initialize({...}), ...)). The typescript definition file (.d.ts) is also published in that PR to install it from DefinitelyTyped (npm install --save-dev @types/artyom.js) and reference it from tsconfig.json.
Moreover, you can see another real example in that repository: Angular2 & WebAudio
Working with artyom is cool and easy, read the documentation to discover more awesome features.
Thanks for visit the repository !