jstrait / wavefile

A Ruby gem for reading and writing sound files in Wave format (*.wav)
https://wavefilegem.com
MIT License
209 stars 24 forks source link

odd number size riff chunk #8

Closed kookster closed 10 years ago

kookster commented 11 years ago

I think you may not be handling adding or reading an extra pad byte when a chunk has a size that is an odd number of bytes. Not all wav creators seem to do this but adobe audition does, and it leads to misaligned parsing of the riff chunks.

I tested such a file with your gem and it choked on it.

Here is more info from a similarly reported issue:

http://forums.adobe.com/message/3798778

jstrait commented 11 years ago

Thanks for the heads up! I believe the gem is correctly adding a padding byte to the data chunk when writing a file with an odd number of bytes of sample data, but like you said isn't compensating for odd chunk sizes when reading. I'll take a look at a bug fix.

jstrait commented 10 years ago

I just released a new version (0.6.0) which should contain a fix for this. Specifically, when reading chunks with an odd size, an extra byte is read at the end of the chunk to account for the expected even byte alignment. Let me know if you continue to run into issues after updating, and feel free to reopen this issue is so. Thanks for bringing this up!