add recorder file

This commit is contained in:
riqo 2021-02-03 18:01:48 -06:00
commit 1a328b41b9
3 changed files with 84 additions and 13 deletions

View file

@ -9,20 +9,11 @@ const fs = require('fs');
import WebSocket from "ws";
const portAudio = require('naudiodon');
// Create an instance of AudioIO with inOptions (defaults are as below), which will return a ReadableStream
const audioOptions = {
channelCount: 2,
sampleFormat: portAudio.sampleFormat16Bit,
sampleRate: 16000,
deviceId: -1, // Use -1 or omit the deviceId to select the default device
closeOnError: false // Close the stream if an audio error is detected, if set false then just log the error
}
const ai = new portAudio.AudioIO({
inOptions: audioOptions
});
// const ai = new portAudio.AudioIO({
// inOptions: audioOptions
// });
//ai.pipe();
ai.start();
// ai.start();
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.