Skip to content

JKimMason/speechless

Repository files navigation

logo-text

Speech to text recognition with remote fallback (Native/External)

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

About

Speech to text recognition with remote fallback

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published