-
Notifications
You must be signed in to change notification settings - Fork 0
IBM Watson Speech toText
Make a project in IBM Bluemix. You'll be provided a username and password. Use the username and password to get a token. The token must specify "/speech-to-text/".
curl -X GET --user af02b2e3-064c-46f0-922c-56ae6a1e7854:LUHc0mlK002x \ --output token \ "https://stream.watsonplatform.net/authorization/api/v1/token?url=https://stream.watsonplatform.net/speech-to-text/api"
Tokens expire in one hour.
The session steps are:
- Open a session.
- Starting transcribing.
- Stop transcribing.
- Close session.
You also need to log messages:
function onMessage(evt) { console.log(evt.data); }
websocket.onmessage = function(evt) { onMessage(evt) };
Opening a Session
function onOpen(evt) { var message = { 'action': 'start', 'content-type': 'audio/l16;rate=22050' }; websocket.send(JSON.stringify(message)); };
websocket.onopen = function(evt) { onOpen(evt) };
You'll get back the message:
{ "state": "listening" }