- Notifications
You must be signed in to change notification settings - Fork0
Library for using the IBM Watson Speech to Text and Text to Speech services in web browsers.
acbrant/speech-javascript-sdk
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
IBM Watson Speech Services for Web Browsers
Allows you to easily add voice recognition and synthesis to any web app with minimal code.
This library is primarily intended for use in web browsers. Check outibm-watson to use Watson services (speech and others) from Node.js.
However, aserver-side component is required to generate auth tokens. SDKs are available forNode.js,Java,Python, which can be used with a server-side application.
Pre-compiled bundles are available from on GitHub Releases - just download the file and drop it into your website:https://github.com/watson-developer-cloud/speech-javascript-sdk/releases
bower install --save watson-speech
This library can be bundled withbrowserify orWebpackand easy included in larger projects:
npm install --save watson-speechThis method enables a smaller bundle by only including the desired components, for example:
varrecognizeMic=require('watson-speech/speech-to-text/recognize-microphone');
This SDKCAN be used in the browser with services that use IAM for authentication. This does require a server-side component - an endpoint used to retrieve the token.
In a local environment you should set only theTEXT_TO_SPEECH_IAM_APIKEY andSPEECH_TO_TEXT_IAM_APIKEY in your.env file.
Once that is set up, the token can be used in your SDK request with the parameteraccess_token.
Make surepolyfills.ts has following entries:
(windowasany).global=window;(windowasany).process=require('process/browser');import'zone.js/dist/zone';// Included with Angular CLI.global.Buffer=global.Buffer||require('buffer').Buffer;
SeeCHANGELOG.md for a complete list of changes.
Unfortunately, there is no way to set or get the global transaction id provided by the initial websocket handshake with the Speech service. This is due to limitations from the W3C Websocket API for browser. It is possible; however, to grab theX-Global-Transaction-Id header through a browser's dev tool "Network" tab. After making a call to the service, look for a request to thev1/recognize endpoint which should return a 101 code. The response headers from that request will contain theX-Global-Transaction-Id header.
The test suite is broken up into offline unit tests and integration tests that test against actual service instances.
npm testwill run the linter and the offline testsnpm run test-offlinewill run the offline testsnpm run test-integrationwill run the integration tests
To run the integration tests, service credentials are required. Make sure you have a valid.env file in the root directory.
About
Library for using the IBM Watson Speech to Text and Text to Speech services in web browsers.
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Languages
- JavaScript97.7%
- Shell2.3%