audiocogs / flac.js

FLAC decoder in JavaScript
http://audiocogs.org/codecs/flac/
548 stars 46 forks source link

8bps sound not being correctly decoded #9

Closed satazor closed 9 years ago

satazor commented 10 years ago

I've tried to play a 8bps flac sound and the sounds is really strange.

I managed to identify the issue, bellow are the changes that I had to do:

var output = new ArrayBuffer(this.blockSize * channels * (is32 ? 32 : 16) / 8)

I've also removed the << sampleShift instructions. You can also set sampleShift = 0 to test it out.

I'm I missing something here? Placing 8bits integer into 16bits does not require shifting. Is this related to big/little endian?

devongovett commented 9 years ago

Yup, you are right. Sorry this is almost a year later (oops). Should be fixed by aa47cb9 and deb2f39. Also fixes 24 bit (non LPC) files - see #15. Not sure what the sampleShift thing was, but I removed it. An artifact from the port of libav, which has that. Still not sure why, but it's better without it so yay. :smile: