Skip to content
This repository was archived by the owner on Dec 26, 2022. It is now read-only.

Latest commit

 

History

History
 
 

readme.md

Watson Speech JavaScript SDK Examples

This folder has example Node.js and Python servers to generate auth tokens and several html files (in static/) with different examples of using the Speech SDK.

There are also a few audio files to test with in the static/ folder.

Prerequisite

Setup - Node.js

  1. cd into the examples/ directory and run npm install to grab dependencies (this automatically runs postinstall that also puts the dependencies into place)
  2. Based on test/resources/stt-auth-example.json, create test/resources/stt-auth.json with credentials
  3. Based on test/resources/stt-auth-example.json, create test/resources/tts-auth.json with credentials
  4. run npm start
  5. Open your browser to http://localhost:3000/ to see the examples.

Notes

  • The examples all use fetch (a modern promise-based replacement for XMLHttpRequest) to retrieve auth tokens. Most supported browsers include a native fetch implementation, but a pollyfill is included in the top-level module for older browsers.
  • The examples use a Node.js server to generate tokens. It doesn't have to be written in Node.js, but some server-side token generator is required. The SDK will not accept your service credentials directly, and you can not use them to generate a token client-side. SDKs are available for Node.js, Java, Python, and there is a REST API for use with other languages (or curl).
  • The Speech SDK may be used in browserify, Webpack, or as a standalone library. Most of the examples use the standalone version either installed via NPM or symlinked to the root directory when developing locally.

More Examples