{"id":15595812,"url":"https://github.com/cdimascio/watson-html5-speech-recognition","last_synced_at":"2025-04-24T06:33:58.784Z","repository":{"id":65379239,"uuid":"59374156","full_name":"cdimascio/watson-html5-speech-recognition","owner":"cdimascio","description":"Speech Recognition for Browsers via Webkit, HTML5, and Watson","archived":false,"fork":false,"pushed_at":"2016-11-06T19:58:05.000Z","size":99,"stargazers_count":4,"open_issues_count":3,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-08T15:51:14.182Z","etag":null,"topics":["speech-recognition","watson","watson-speech","watson-speech-sdk","web-speech-api"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cdimascio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-21T17:55:49.000Z","updated_at":"2017-10-24T15:49:34.000Z","dependencies_parsed_at":"2023-01-20T08:45:37.724Z","dependency_job_id":null,"html_url":"https://github.com/cdimascio/watson-html5-speech-recognition","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdimascio%2Fwatson-html5-speech-recognition","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdimascio%2Fwatson-html5-speech-recognition/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdimascio%2Fwatson-html5-speech-recognition/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdimascio%2Fwatson-html5-speech-recognition/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cdimascio","download_url":"https://codeload.github.com/cdimascio/watson-html5-speech-recognition/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250579659,"owners_count":21453518,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["speech-recognition","watson","watson-speech","watson-speech-sdk","web-speech-api"],"created_at":"2024-10-03T01:01:29.247Z","updated_at":"2025-04-24T06:33:58.753Z","avatar_url":"https://github.com/cdimascio.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# watson-html5-speech-recognition\n\nA Library to provide speech recognition capability in browsers.\n\n## Support\nThe library enables speech recognition support for any browser that includes support for either:\n\n- [Web Speech API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API) **or**\n- [Web Audio API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API) + [getUserMedia](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/getUserMedia) support\n\nIf the browser does not support either of the above, then currently you're out of luck.\n\n\nwatson-html5-speech-recognition use Web Speech API when present and Watson Speech To Text service for all other (supported) cases.\n\nCurrently, the following are supported:\n\n- Webkit speech recognition\n\t- Chrome (33)\n\t- FireFox (\u003e=44)\n\t\n- Watson Speech to Text\n\t- Microsoft Edge\n\t- Firefox (\u003c44)\n\t- Opera\n\n## Prequisites\n\n1. An instance of [Watson Speech To Text Service](https://console.ng.bluemix.net/catalog/services/speech-to-text/) (requires a [Bluemix](http://www.bluemix.net) account)\n2. Watson Speech to Text Websocket server (provided. see **Example** section below)\n\n\n## Install\n\n```shell\nnpm install watson-html5-speech-recognition\n```\n\n## Usage\n```javascript\nvar Speech = require('watson-html5-speech-recognition');\nvar speech = new Speech.SpeechToText();\n\nspeech.listen({\n    onStart: function() {\n        console.log('starting');\n    },\n    onResult: function(e) {\n        console.log(e.text);\n    },\n    onError: function(e) {\n        console.log('error', e);\n    },\n    onEnd: function(e) {\n        console.log('end', e);\n    }\n});\n```\n\n## Customized Usage\nIf Watson speech services are engaged, the watson-html5-speech-recognition request a token from the server then communicates via websocket. \n\nBy default, watson-html5-speech-recognition assumes the token endpoint exists at `/api/speech-to-text/token`. If you alter the location of that endpoint, you must supply the new location via a configuration parameter upon instantiation. Like so...\n\n```javascript\nvar Speech = require('watson-html5-speech-recognition');\nvar speech = new Speech.SpeechToText({\n  watsonTokenUrl: `/path/to/my/speech-to-text/token`\n});\n```\n\n**NOTE:** The example server uses the `watson-developer-cloud` npm package to configure the token endpoint (see `example/server/stt-token.js`).\n\n## Example\nThe example contains a simple web front end, along with a backend web socket server that communicates with the Watson Speech To Text service\n\n### Setup the example\nClone the example:\n\n```shell\ngit clone https://github.com/cdimascio/watson-html5-speech-recognition\n```\n\nNavigate to the example root:\n\n```shell\ncd example/server\n```\n\nInstall dependencies:\n\n```shell\nnpm install\n```\n\nBuild the example:\n\n```shell\nnpm run compile\n```\n\n### Run the example:\n\nFirst, be sure to complete all steps in the section above, \"Setup the example\"\n\nThen,\n\nOpen `stt-token.js` to line 10 \n\nSet `'\u003cyour-username\u003e'` and `'\u003cyour-username\u003e'` to match your [Watson Speech To Text Service](https://console.ng.bluemix.net/catalog/services/speech-to-text/) credentials.\n\n```shell\nnpm start\n```\n\nTry it:\n\n- Navigate to [http://localhost:3000](http://localhost:3000)\n- Click the 'mic' button\n- Speak\n\n## About the example\nThe `watson-html5-speech-recognition` library is exposed as a node module. It, thus can be used seamlessly with build tools like webpack, browserify, jspm, etc. \n\nFor the purpose of this example, we use Browserify to generate `speech.js` from `main.js`. Once generated, `speech.js` can be included in your webpage via script tag. See `index.html`.\n\nIf you want to further customize `main.js`, you must regenerate `speech.js`. To do so:\n\n- `cd example/server`\n- `npm run compile`\n\nAll example files live in `example/server`.\n \nUI client files:\n\n- `public/main.js` sets up `watson-html5-speech-recognition` and adds an instance to the global space. \n- `public/speech.js` is generated from `main.js` by Browserify. (`npm run compile`)\n- `public/index.html` contains application to listen for user input and output it to the screen.\n\nServer files:\n\n- `app.js` creates an express server and exposes a base route for speech to text endpoints\n- `stt-token.js` instantiates watson speech to text and provides an endpoint to request speech to text authorization tokens.\n\n\n## License\n\nApache 2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdimascio%2Fwatson-html5-speech-recognition","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcdimascio%2Fwatson-html5-speech-recognition","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdimascio%2Fwatson-html5-speech-recognition/lists"}