0
您好我在NodeJS中實施Sox-Stream和SoX時遇到了問題。我已經廣泛閱讀了文檔,但代碼的輸出不會導致保存的音頻mp3播放器。我已經嘗試了很多次,通過更改NodeJS錄製模塊來修復此問題,以重新創建代碼庫。出於某種原因,效果線不能按計劃運行。如果我註釋掉效果線,它會保存音頻。任何人對我可能出錯的地方有任何建議?任何援助將不勝感激。SOX Nodejs SoX-Stream節點 - 麥克風 - 嘗試將效果應用到實時流時出現SoX錯誤
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);
});