Open
Description
I have ported the libopus using emscripten and decoding opus to pcm.
Now I am sending this decoded pcm data to this pcm-player but it just playing noise and not the actual audio.
From libopus I am getting Uint8Array and I am converting the data to Float32Array before calling feed
method of pcm-player but it not playing.
Following code call back I have used to convert the data received from libopus to java script.
function convertBlock(incomingData) { // incoming data is a UInt8Array
var i, l = incomingData.length;
var outputData = new Float32Array(incomingData.length);
for (i = 0; i < l; i++) {
outputData[i] = (incomingData[i] - 128) / 128.0;
}
return outputData;
}
function frame_opusCallback(a,b)
{
//console.log("Getting callback from liobopus"+b);
var incomingData= new Uint8Array(Module.HEAP8.buffer, a, b);
var sampledata = convertBlock(incomingData);
pcmPlayer.feed(sampledata.data);
}
Please let me know what is going wrong in this implementation.