Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

speech-flow

Use the WebSpeach API with events.

Listen to a word or quote and the trigger all the callbacks.

Documentation

Speech-flow can be used by code or bootstrapping the DOM.

There is two dist compilations, the first (speech-flow.min.js) it's the minified code , the second (speech-flow.uni.min.js) adds the PhenomenonJS's code inside to avoid to include it in you HTML.

Constructor

The constructor has this properties:

  • lang: Language code.
  • ignoreCase: Define if the cases have a meaning when the speech is interpreted.
  • ignoreDiacritics: Define if the diacritics characters are replaced with their base when the speech is interpreted.

by code

Using code you need to create a speech-flow, attach the words or quotes with a callback and start listening.

speak = new SpeechFlow({
  lang: "en-US",
  ignoreCase: true,
  ignoreDiacritics: true
});

speak.on('my quote', function(){

});

speak.start();

by bootstrap

Using the bootstrap function you only need to add the speech-flow attribute to an element with this structure as value word or quote:function to execute.

The bootstrap method receive an object with this options.

  • autoStart: Define if speech-flow starts to listen automatically.
<button id="btn1" speech-flow="hello:myFunction">Button 1</button>
speak = new SpeechFlow({
  lang: "en-US",
  ignoreCase: true,
  ignoreDiacritics: true
});

function myFunction(){
  console.log('this function is triggered by the voice');
  console.log(this);
}

speak.bootstrap({
  autoStart: true
});

About

Use the WebSpeach API with events

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages