Skip to content

AshmaDev/babbler.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

babbler_logo

Simple programmable Web Speech API implementation.

Usage

This is a really simple implementation of the Web Speech API.

const babbler = new Babbler({
  lang: 'en', // language
  voice: 'Microsoft George - English (United Kingdom)' // voice name
});

To say something, use:

babbler.Speak("Hello World!");

babbler.Speak("Hello!").then(()=>{
  // do something
  babbler.Speak("How are you today?");
});

To listen, use:

const callbacks = {
  start: () => console.log("Babbler listener has started"),
  end: () => console.log("Babbler listener has started"),
  error: (e) => console.error("Babbler error", e),
  result: (r) => console.log("Babbler result", r),
};

babbler.Listen(callbacks);

const doSomethingWithResult = (r) => {
  const result = event.results[0][0].transcript;
  // do something with your result here
}

babbler.Listen({
  result: doSomethingWithResult
});

You can easily extend Babbler with your own functionalities.

Babbler.prototype.customBabblerFunction = () => {
  console.log("This is my custom functionality!");
}

const babbler = new Babbler(/* config */);

babbler.customBabblerFunction();

You can also read more about Web Speech API in the docs.

License

This project is licensed under the MIT License.

About

Web Speech API Implementation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors