The dictation object allows you to make an easy dictation with a couple of lines of code.

You can create a dictation system for your user with the original webkitSpeechRecognition, however it's not a quick task to do. Instead you can use the artyom library to accomplish this.


A dictation object can't be active when artyom is active, is recommendable to deactivate artyom with artyom.fatality() before start a newDictation object to prevent errors, you can activate artyom again when the event onEnd of the dictation object is triggered.

The newDictation method expects a single argument, an object with the described properties:

Property name Type Description
continuous Boolean If you have a https connection, this property can be set to true and the dictation object will NEVER STOP unless you execute stop method. Without a https connection, the dictation object will stop after a determinated time.
onResult Function You can manipulate the output of the dictation in this property, see examples down.
onStart Function Do something when the dictation event is started
onEnd Function Do something when the dictation is stopped

The usage logic is simple, create a dictation object with the newDictation method, and store it in a variable. The returned object will have 2 properties start and stop.


var settings = {
    continuous:true, // Don't stop never because i have https connection
        // Show the Recognized text in the console
        console.log("Recognized text: ", text);
        console.log("Dictation started by the user");
        alert("Dictation stopped by the user");

var UserDictation = artyom.newDictation(settings);

// Link the events to buttons in the document
    // Start the Dictation

    // Stop the Dictation