I'm working on Discord voice and I made voice receiver, but I can't seem to be able to write the audio buffer to a file to be able to play it. Here's my code:
stopRecording() {
this.recording = false;
let output = Buffer.concat(this.recordedBuffers);
fs.writeFileSync('./out.opus', output.toString());
this.recordedBuffers = [];
console.log('done');
};
The file gets created but it is unplayable. Any ideas?