Skip to content
:speech_balloon: Speech recognition for your site.
JavaScript HTML CSS
Find file


A tiny javascript SpeechRecognition library that lets your users control your site with voice commands.

annyang has no dependencies, weighs just 2 KB, and is free to use and modify under the MIT license.

Demo & Tutorial

Play with some live speech recognition demos

Technical Documentation and API

Docs and full API reference

Hello World

It's as easy as adding one javascript file to your document, and defining the commands you want.

<script src="//"></script>
if (annyang) {
  // Let's define a command.
  var commands = {
    'hello': function() { alert('Hello world!'); }

  // Add our commands to annyang

  // Start listening.

Check out some live speech recognition demos and advanced samples, then read the full API Docs.

Adding a GUI

You can easily add a GUI for the user to interact with Speech Recognition using Speech KITT.

Speech KITT makes it easy to add a graphical interface for the user to start or stop Speech Recognition and see its current status. KITT also provides clear visual hints to the user on how to interact with your site using their voice, providing instructions and sample commands.

Speech KITT is fully customizable, and comes with many different themes (and instructions on how to create your own designs).

Speech Recognition GUI with Speech KITT

<script src="//"></script>
<script src="//"></script>
if (annyang) {
  // Add our commands to annyang
    'hello': function() { alert('Hello world!'); }

  // Tell KITT to use annyang

  // Define a stylesheet for KITT to use

  // Render KITT's interface

For help with setting up a GUI with KITT, check out the Speech KITT page.

(annyang) would like to use your microphone

Chrome's implementation of SpeechRecognition behaves differently based on the protocol used:

  • https:// Asks for permission once and remembers the choice.

  • http:// Asks for permission repeatedly on every page load. Results are also returned significantly slower in HTTP.

For a great user experience, don't compromise on anything less than HTTPS (available free with CloudFlare and Let's Encrypt).


Tal Ater: @TalAter


Licensed under MIT.

Something went wrong with that request. Please try again.