W
W
Wasya UK2020-07-26 22:20:47
Node.js
Wasya UK, 2020-07-26 22:20:47

Why is audio not being recorded?

I use naudiodon, tried to record system audio, but the resulting files do not start. When recording stops, I get a message in the console: Finishing input - 4608 bytes not available to fill the last buffer


const portAudio = require('naudiodon');
const fs = require('fs');

console.log(portAudio.getDevices());

var ai = new portAudio.AudioIO({
  inOptions: {
    channelCount: 2,
    sampleFormat: portAudio.SampleFormat16Bit,
    sampleRate: 44100,
    deviceId: -1,
    closeOnError: true then just log the error
  }
});

var ws = fs.createWriteStream('rawAudio.wav');

ai.pipe(ws);
ai.start();

ai.on('data', buf => console.log(buf.timestamp));

// setTimeout(() => {
//   ai.quit();
// }, 5000);

process.on('SIGINT', () => {
  console.log('Received SIGINT. Stopping recording.');
  ai.quit();
});

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question