Skip to content

Releases: TalAter/annyang

Maintenance release

07 May 11:18
Compare
Choose a tag to compare

👍 This release is 100% backwards compatible with all v2 releases.

Ensured support up to Node.js 10.
Updated dependencies and rebuilt for a more efficient distributable.

Awesome people ⭐

Special thanks to:

Added soundstart event

07 Oct 10:39
Compare
Choose a tag to compare

👍 This release is 100% backwards compatible with all v2 releases.

[Added] Allow listening to the soundstart event

You can now add a callback event which will run when the speech recognition's soundstart event fires.

annyang.addCallback('soundstart', fn);

This event will fire once per speech recognition session (due to a bug in Chrome). If you would like to get it again the next time sound is heard, you can abort and restart speech recognition… which is the default behavior in HTTPS anyway. In other words, in HTTPS it works great.

See a more complete example for detecting when the user starts and stops speaking in the FAQ.

Changed file structure and development stack

The main annyang files which you will include in your project are now in the /dist directory:

If you would like to work on annyang's code itself, it is now in the /src directory:

annyang's source now passes through babel with the es2015 preset, so you can use ES2015 language features in it.

Awesome people ⭐

Special thanks to:

  • @remybach - For the original soundstart event code, and helping determine the final functionality.
  • @peterdillon - Helping create a use case to test the new soundstart event.

Added support for starting in paused mode. Bug fix: autorestart causes unpausing. Error callback include event.

22 Aug 15:11
Compare
Choose a tag to compare

👍 This release is 100% backwards compatible with all v2 releases.

[Added] Allow starting annyang in paused mode

The options object passed to annyang.start() now accepts a new attribute called paused.

The following example will start the browser's speech recognition engine, but annyang will be in paused mode (meaning that it will not respond to any speech, even if it matches commands).

annyang.start({ paused: true });

paused is optional and defaults to false if you do not set it.

[Fixed] An autorestart will cause annyang to unpause

As reported in #193, if annyang is paused and set to autorestart, it would be unpaused when the Speech Recognition engine restarts. This has been fixed to maintain the paused state.

[Added] Error callbacks can now access error event

All callbacks added on error events (error, errorNetwork, errorPermissionBlocked, and errorPermissionDenied) are now called with the error event as their first argument.

Sample usage:

annyang.addCallback('error', function(event) {
  console.log(event.error);
});

Awesome people ⭐

A lot of people have helped make this version possible!

Special thanks to:

  • @v12 - Speeding up the Travis build (571fad2)
  • @evancohen - Helping the community with running annyang in Chromium, Electron and Cordova and helping improve annyang's docs (8e5e0c3).
  • @vikas-bansal - Refactoring the debug code (7af107e)
  • @shekit - Spotting the pausing bug (#193).
  • @lmangani - 🌟 Helping the community with so many things.
  • @kelvien - Helping the community with speech recognition in Chromium.
  • @daniel3d - Helping the community with speech recognition in Chromium and Electron.
  • @thurt - Helping with code contributions (#211)
  • @atchyut-re - Helping the community with open issues.
  • @Digitaledgestudios - Helping the community with open issues.
  • @mcollovati - Helping the community with very detailed responses (#216).
  • @daniel3d - Helping with adding error event to the error callbacks.

Added annyang.trigger() method

11 Apr 07:53
Compare
Choose a tag to compare

[Added] annyang.trigger() method

annyang commands can now be triggered manually by emulating speech being said. Pass a sentence, or an array of possible sentences to annyang.trigger(), and annyang will act on them as if they came from speech recognition.

Examples:

annyang.trigger('Time for some thrilling heroics');
annyang.trigger(
    ['Time for some thrilling heroics', 'Time for some thrilling aerobics']
  );

Full support for loading annyang as a module (UMD support)

31 Mar 16:07
Compare
Choose a tag to compare

[Added] UMD support

annyang can now be required as a module in environments that support them.

Here is an example of using annyang in an Electron app (an environment that supports both modules and Speech Recognition):

<script>
  const annyang = require('./annyang.min.js');
  annyang.addCommands({
    'hello': function() {
      console.log('world');
    }
  });
  annyang.start();
</script>

This additional support for modules does not break existing functionality, as annyang is still available in the global scope.

A huge thanks goes to @v12 for all the hard work to make this feature possible!

[Fixed] Fixed tiny init bug

Bug caused an exception to be thrown when attempting to abort annyang before it was initialized.

[Added] New tests added

Improved test coverage of annyang

Awesome people ⭐

A lot of contributors have helped make this version possible!

Special thanks to:

  • @v12 - Added UMD support.
  • @lmangani - Thank you for repeatedly being the first one to step up and help the community with issues.
  • @wizardsambolton - Thank you for helping the community with issues.
  • @rmilesson - Thank you for helping the community with issues.
  • @evancohen - Thank you for helping the community with issues.
  • @sdkcarlos - Thank you for helping the community with issues.
  • @asantos00 - Thank you for helping the community with issues.
  • @chrifpa - Added tests.
  • @MattCain - Added tests.
  • @Byron - Added tests.
  • @timotius02 - Added tests.
  • @ZahraTee - Added tests.

Added annyang.removeCallback(), Speech KITT and a bug fix

27 Jan 08:35
Compare
Choose a tag to compare

[Added] - annyang.removeCallback()

New method allows removing callbacks you attached to events.
Check out the annyang.removeCallback() documentation for details and sample code.

Announcing Speech KITT

Meet Speech KITT - a new library that makes it as easy as possible to create a GUI for users to interact with Speech Recognition

[Fix] Bug

Fixed a bug which caused an error to be thrown when a command that was called by annyang included calls to to remove commands.

Test Coverage Improved

Improved test coverage of annyang using the new Speech Recognition mock object - Corti.

Awesome people ⭐

A lot of new contributors have helped make this version possible!
Special thanks to:
@soney - Found and fixed a bug when removing commands from command
@qgustavor - Documentation
@siawyoung - Added new tests and helped new contributors
@Endi1 - Added new tests
@evaldosantos - Added new tests
@theotow - Added new tests
@mdboop - Added new tests
@wizardsambolton + @MartinKoutny - Idea for removeCallback() method

Added annyang.isListening() method

24 Dec 09:45
Compare
Choose a tag to compare

Added a new method which returns true if speech recognition is currently on. Returns false if speech recognition is off or annyang is paused.

if (annyang) {
  annyang.isListening(); // will return false
  annyang.start();
  annyang.isListening(); // will return true
  annyang.pause();
  annyang.isListening(); // will return false
  annyang.abort();
  annyang.isListening(); // will return false
}

Added Regular Expression commands, event callbacks with parameters, and more

24 Jul 01:40
Compare
Choose a tag to compare

Added

You can now pass an object containing a RegExp and a callback function to the addCommands() or init() methods. This allows for much more powerful command matching

Example:
var calculateFunction = function(month) { console.log(month); }
var commands = {
  // This example will accept any word as the "month"
  'calculate :month stats': calculateFunction,
  // This example will only accept months which are at the start of a quarter
  'calculate :quarter stats': {'regexp': /^calculate (January|April|July|October) stats$/, 'callback': calculateFunction}
}

See https://github.com/TalAter/annyang/tree/master/docs#commands-object for details.

Changed

Some callbacks registered on events will now be fired with parameters.

Example:
annyang.addCallback('resultNoMatch', function(phrases) {
  console.log('No command matched. Possible sentences said:');
  console.log(phrases);
});

annyang.addCallback('result', function(phrases) {
  console.log('Speech recognized. Possible sentences said:');
  console.log(phrases);
});

annyang.addCallback('resultMatch', function(said, commandMatched, phrases) {
  console.log('Command matched');
  console.log('The phrase the user said that matched a command');
  console.log(said);
  console.log('The command that was matched');
  console.log(commandMatched);
  console.log('An array of possible alternative phrases the user might\'ve said');
  console.log(phrases);
});

See https://github.com/TalAter/annyang/blob/master/docs/#addcallbacktype-callback-context for details.

Changed

In debug mode, adding commands no longer logs a message with the number of commands loaded. Instead it logs individual messages for each command registered along with it's name.
If one of the commands could not be loaded because it wasn't properly formatted, an error message with the name of the command will be logged.

Fixed / Added

Documentation expanded and improved.
Greatly expanded README section on callbacks.
Updated README with all changes made in this version.

Added pause() and resume() methods

19 Mar 22:07
Compare
Choose a tag to compare

Added two new methods which allow you to pause() and resume() annyang.

These will just cause annyang to stop responding to speech commands, without actually stopping or restarting the browser's SpeechRecognition engine - which is great because you can now instantly pause-resume-pause-resume at any moment without requesting permissions again (even on HTTP).

This contribution comes from @niki4810 who also provided an interesting scenario for when and how to use this in #98

This release also catches exceptions thrown by the SpeechRecognition engine, if you try to start it when it is already started. The error message is logged to the console (if debug mode is on)

Added option to force continuous or non-continuous mode

24 Nov 19:54
Compare
Choose a tag to compare

You can now pass an optional parameter when starting annyang, to force it to run in continuous or non-continuous mode. When turning continuous mode off, speech recognition will stop as soon as the user stops talking (i.e. only picking up his first sentence).

// Start listening, don't restart automatically
// stop recognition after first phrase recognized
annyang.start({ autoRestart: false, continuous: false });

💡 annyang is pretty smart about guessing when to use continuous mode in order to compensate for issues in webkitSpeechRecognition, as well as for secure and non-secure connections. So, unless you know your application must have continuous mode off, I suggest leaving it at default and simply calling annyang.abort() when you want to stop listening.

This contribution comes from @KeanW, who is building an awesome VR headset for Autodesk powered by annyang!

VR voice controlled headset