Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Speech to Text - Streaming
// 1)
async function transcribeAudioStream(audio, cb) {
// 2)
const recognizeStream = speechClient.streamingRecognize(request)
// 3)
.on('data', function(data){
console.log(data);
cb(data);
})
// 4)
.on('error', (e) => {
console.log(e);
})
.on('end', () => {
console.log('on end');
});
// 5)
audio.pipe(recognizeStream);
audio.on('end', function() { });
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.