const portAudio = require('naudiodon');
const speech = require('@google-cloud/speech');
-
const client = new speech.SpeechClient();
const encoding = 'LINEAR16';
const ws = new WebSocket("ws://localhost:8080");
//const duplex = WebSocket.createWebSocketStream(ws, { encoding: 'binary' });
-let audioChunks = [];
+const audioChunks = [];
const audioInputStreamTransform = new Writable({
write(chunk, encoding, next) {
console.log(chunk)
closeOnError: false // Close the stream if an audio error is detected, if set false then just log the error
}
-let audioData = [];
+const audioData = [];
const ai = new portAudio.AudioIO({
inOptions: audioOptions
});