vinni
vinni

Reputation: 653

Connect Browser Microphone stream to Google Speech Api via node

I just started with node.js and am trying to connect the generated microphone stream from the browser with the google speech api running on my node server and the microphone-stream package.

I successfully packed the necessary modules with browserify, but now don't know how to proceed. I got the microphone stream to work on the node server as well (as explained here: Streaming Speech Recognition on an Audio Stream ).

How can I transmit the audiostream? I read about using websockets in one issue, but didn't really understand if it's the right way in my case. Or RPC?

For now I'm using these packages on the server:

const express = require('express');
const path = require('path');
const bodyParser = require('body-parser');
const fs = require('fs');
const record = require('node-record-lpcm16');
const google = require('googleapis');
const getUserMedia = require('get-user-media-promise');
const MicrophoneStream = require('microphone-stream');

This is my first time using node / a server, so hopefully this question isn't too naive. Thanks! :)

Upvotes: 4

Views: 2234

Answers (1)

vinni
vinni

Reputation: 653

I built a playground to tackle this task. It doesn't use any of the previous plugins (node record 16 / microphone-stream / ...) but sends a 16 bit audio stream to the node server via socket.io.

https://github.com/vin-ni/Google-Cloud-Speech-Node-Socket-Playground

Upvotes: 6

Related Questions