Closed vinnitu closed 5 years ago
Must be equal based on what? Where did you get that reference data?
Opus is a lossy format and there's various things, such as sample rates that would change the output.
I saw it in zello-channel-api in https://github.com/zelloptt/zello-channel-api/blob/master/sdks/js/dist/zcc.decoder.js
t.prototype.decodeFloat32=function(e){return new Float32Array(this._decode(e,4,_opus_decode_float))}
I added console.log to debug it
t.prototype.decodeFloat23 = function(e) {
console.log(e); // encoded
const x = this._decode(e,4,_opus_decode_float);
console.log(x); // decoded
return new Float32Array(x);
}
I know sampleRate and channels and try use your code to do this task but unsuccessfully
Based on the comments in that other issue, you're after raw opus frames. The OpusEncoder gives you opus audio within ogg container, so this is not what you want.
Yes, I need to get pcm data from raw opus frames. In my example var encoded is such data.
const encoder = new opus.OpusEncoder(sampleRate, channels);
const decoded = encoder.decode(packet);
that is all, sorry for time