Node.js Websocket streaming on Bluemix

I am implementing the following use case using Watson Speech-To-Text service (STT):

Client(Some another location) is getting microphone input and stream the audio to the server(It is Bluemix application with node.js). WebSockets or HTTP live streaming can be used to stream audio to the server.

Server waits for connection and audio stream from client. As soon as starting to receive audio, server stream audio to STT while receiving.

Most of the STT samples are written to get voice input directly from client but not server.

Creating pipe is one alternative. But in that method it is reading audio file from server location('sample.wav'). Also it uses HTTP and not the websockets.

1 reply

Can you use the sample below as a starting point? You probably would need to replace captureP = spawn('ffmpeg', [... by your own process. In this code the device in the config file was set to "default". You can install ffmpeg using, for instance. brew: brew install ffmpeg. const spawn = require('child_process').spawn; const watson = require('watson-developer-cloud'); const stream = require('stream'); const config = require('nconf');