The company I'm working with has an overseas microphone manufacturer. It's been quite difficult to communicate with them. So far I know the data being streamed back has "8:1 Opus Compression" and the chip they're using is ats2837... I created a sample recording, and stored all the data that're being streamed back. The total byte is 14760, which then I would decode it into PCM that represent 3 seconds of audio. So far I identified repeating header which is "5b 50", and I turned it into chunks. Can someone give me a clue what I'm dealing with here? section of the stream
Here's the link to stream output to a encoded text file and just plain hex I got from the device.
I'm writing the logic in Javascript, and I used "audify" library. But when imported it into Audacity, I just get bunch of white noise. Here's the link to the library.
const { OpusEncoder, OpusDecoder, OpusApplication } = require('audify');
// 8000, 12000, 16000, 24000, or 48000
const newDecoder = new OpusDecoder(48000, 1);
const frameSize = 1920; // 40ms
var decodedArr = [];
pcmDataChucks.forEach(d => {
let decimal = hexStringToDecimalArray(d);
let decoded = newDecoder.decode(Buffer.from(decimal.slice(2, decimal.length)), frameSize);
decoded = new Uint8Array(decoded);
decodedArr = [...decodedArr, ...decoded];
})
fs.writeFile('audio_test.txt', Buffer.from(decodedArr), (err) => {
if (err) {
console.error('Error writing to file:', err);
} else {
console.log('File has been written successfully.');
}
});