5

I have looked into Google Cloud Speech API and got streaming my microphone working on a Node server.

I was then wondering what would be best practice for streaming my microphone from a web frontend? Is it sending an audiostream from getUserMedia to the Node server and pipe it to the API with the Node API client? Or is is simply saving the voice input to a file that I then transmit to the API?

The intent is to "transcribe" instructions (one or two sentences long) and send the result to another API.

Nikolay Shmyrev
  • 24,897
  • 5
  • 43
  • 87
Adam Byström
  • 51
  • 1
  • 3
  • You can transmit data to API directly from getUserMedia without saving it to a file and without intermediate node server. – Nikolay Shmyrev Mar 28 '17 at 21:39
  • Thank you for your answer! How would one go about doing that? As I understand the REST API don't support streams (?) – Adam Byström Mar 29 '17 at 08:14
  • Something like this https://www.npmjs.com/package/grpc-web-client – Nikolay Shmyrev Mar 29 '17 at 15:57
  • Looking at the git repo for that package it looks like it doesn't support streaming; "It is very important to note that the gRPC-Web spec currently does not support client-side streaming. ". (https://github.com/improbable-eng/grpc-web) – Adam Byström Mar 31 '17 at 09:02
  • Hi Adam, did you find a solution for this? thanks – Cam Apr 04 '17 at 22:59
  • Unfortunately no. I was looking into streaming microphone audio over websocket to a node server and then piping it to the API via the Node API client. But sorry to say, I've had to put it on hold for now. – Adam Byström Apr 11 '17 at 11:12
  • 1
    I'm looking to do this too, and am stuck at the moment. I've tried using socket.io, but can't figure out how to convert the buffered audio from the browser into a pipe-able stream to send to Google Speech API. The other option I've come across is to use binary.js, which seems to be working better, but I end up with a "BinaryStream" object on the server that I don't know what to do with. Has anyone used either of these methods with success? – ItJustWerks Apr 19 '17 at 15:47
  • Hi. Is there an update on this one? Is it possible to make gRPC call directly from client side without using any server side language. If not, what is the alternative to achieve this using javascript and java? Any help would be appreciated. Thanks :-) – PRANSHU MIDHA Sep 04 '17 at 05:49

1 Answers1

1

I'm aware this question is over a year old and the OP has probably either found an answer or given up, but I spent long enough trying in vain to google this before I figured it out that I wanted to help anyone following in my footsteps: I wrote up a tutorial for basically this exact situation here.

Amber B.
  • 1,134
  • 10
  • 20