Closed richastral closed 1 year ago
hi there! mind providing some more information about your system? OS, version, node version, etc?
i'm with the same problem, except that i don't get this error message, i't just crash. My code is pretty much the same, is from the example on the readme
anyone succeeded?
I think the reason is that the stream in fact expects the 'string or an instance of Buffer or Uint8Array', and the library provides something different like raw bytes. Try wrapping like this:
Buffer.from(audio.buffer, audio.byteOffset, audio.byteLength)
Running the simple example:
const { SpeechRecorder } = require("speech-recorder"); const fs = require('fs');
const writeStream = fs.createWriteStream("audio.raw"); const recorder = new SpeechRecorder({ onAudio: ({ audio }) => { writeStream.write(audio); } });
console.log("Recording for 5 seconds..."); recorder.start(); setTimeout(() => { console.log("Done!"); recorder.stop(); }, 5000);
and I get the error:
ibc++abi: terminating with uncaught exception of type Napi::Error: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of Int16Array
No matter what I do I get this error, what am I doing wrong?