loadCompressedDataFromByteArray missed some data

768 Views Asked by At

I tried to extract raw data from loaded mp3 file. And suddenly, sound.extract method returned less data then Math.floor( sound.length * 44.1 ).

sound = new Sound();
sound.loadCompressedDataFromByteArray( data, data.length );
_output = new ByteArray();
var len : Number = sound.extract( _output, Math.floor( sound.length * 44.1 ) );

For example:

Math.floor( sound.length * 44.1 ) = 213120, but len = 211968 :(

I tried many mp3 files and sound.extract always return less data then expected.

I also tried load data use sound.load() function and in this case, sound.extract returned exactly Math.floor( sound.length * 44.1 ) as expected.

Math.floor( sound.length * 44.1 ) = 213120 and len = 213120 :)

Direct download using sound.load function doesnt fit me very well, because i analyze mp3 LAME frame for encoderDelay and encoderPadding. For play mp3 without gap.

Does anybody know is it loadCompressedDataFromByteArray Adobe bug or i did something wrong?

0

There are 0 best solutions below