cryptix/wav

Signed 16bit stream incorrectly converted

Opened this issue · 4 comments

Reading a 2-channel, signed 16bit PCM stream doesn't work (common) because the bytes are converted to int32 instead of int16

n = int32(s[0]) + int32(s[1])<<8

n = int16(buf[0]) + int16(buf[1])<<8

You can see a copy of the byte stream graphed here: http://imgur.com/a/TVuH6

We might want to change the logic for 1 or 2 byte sequences to calculate as a signed 16bit number and then type cast to 32 bit.

Consider this conversion to float32 using int64 for the full range of values from more than WAV audio sources.

Looks like @nathan-cormier also ran into this? (re #14)

@xeoncross the link you posted was based on a branch and now points to some unrelated code.. :'( can you update it?