This package has been deprecated

Author message:

Package no longer supported. Contact support@npmjs.com for more info.

speechless
TypeScript icon, indicating that this package has built-in type declarations

0.2.5 • Public • Published

logo-text

Speechless is a library to make working with Web Speech API on the web easier. It provides a consistent API for speech to text in different browsers, in the situation that the API is not available yet you can supply a fallback to your own speech to text API.

Travis Coveralls Dev Dependencies styled with prettier

Why

  • Save money and use native speech-to-text recognition
  • Hide the complexity with a simple interface
  • Easy events
  • 100% test and coverage
  • Types for better development

Demo

https://speechless.surge.sh/

TypeDocs

https://puemos.github.io/speechless

Install

$ npm i speechless --save
$ yarn add speechless
<script src="https://rawgit.com/puemos/speechless/master/dist/speechless.umd.js"></script>

Usage

 
import { RecognitionFactory } from 'speechless';
 
// Create event listeners
const onData = (data: string | any) => console.log(data)
const onStart = () => console.log('start')
const onFetching = () => console.log('feching')
const onEnd = () => console.log('ended')
const onStop = () => console.log('stopped')
 
// Fallback function for remote call recognition
function remoteCall(blob: Blob){
  return fetch("/remote/recognition", {
    method: "POST",
    body: blob
  })
  .then(function(res){ return res.json(); })
}
 
// Create new instance
const recognition = RecognitionFactory('en', remoteCall)
 
// Connect the listeners
recognition.addEventListener('end', onEnd)
recognition.addEventListener('data', onData)
recognition.addEventListener('fetching', onFetching)
recognition.addEventListener('stop', onStop)
recognition.addEventListener('start', onStart)
 
// Start listening
recognition.listen()
 

Events

Event 'start'

function () {}

Emitted on successful recognition start

Event 'end'

function () {}

Emitted after successful recognition end

Event 'stop'

function () {}

Emitted after a force stop.

Event 'fetching'

function () {}

Emitted when the the audio is being sent to 3-rd party service

Event 'data'

function (event) {}

Emitted when the new recognition data is avialible

event.detail === 'hello world'

Contributing

Speechless is an OPEN Open Source Project. This means that:

Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit.

Contributors

Shy AlterGitHub/puemosTwitter/@puemos

License

MIT

Package Sidebar

Install

npm i speechless

Weekly Downloads

2

Version

0.2.5

License

MIT

Unpacked Size

6.76 MB

Total Files

41

Last publish

Collaborators

  • npm