Tuesday 9 May 2017

SOX Nodejs SoX-Stream Node-Microphone - error with SoX when trying to apply effects to realtime stream

Hi I am having a problem with implementing Sox-Stream and SoX in NodeJS. I have read the documentation extensively, however the output of the code does not result in a saved audio mp3 player. I have tried many times now to fix this, by changing NodeJS recording modules, to recreating the code base. For some reason, it is the effects line that isn't working as planned. Any one have any suggestions on where I could be going wrong? Any assistance would be greatly appreciated.

let Mic = require('node-microphone');
let fs = require('fs');
let mic = new Mic();
let micStream = mic.startRecording();
let sox = require('sox-stream');

let dest = fs.createWriteStream('song.mp3')
let transform = sox({
   output: { type: 'mp3' },

   effects: 'silence -l 1 0.1 1% -1 2.0 1%'

});

micStream.pipe( transform ).pipe( dest );

setTimeout(() => {
  console.log('stopped recording');
  mic.stopRecording();
}, 5000);

mic.on('info', (info) => {
    // console.log(info);
});

mic.on('error', (error) => {
    console.log(error);
});



via user1871891

No comments:

Post a Comment