Why is the data subchunk of some wav files 2 bytes off?

May 6, 2014 in answer

0 votes, 0.00 avg. rating (0% score)

ANSWER:

This is a guess, but have you looked at the four-byte number at offset 16 in the files where data starts at offset 38? The fmt sub-chunk is of variable size, and its size is specified in a dword at offset 16 relative to the chunk ID, which is at zero in your files. That size is the size of the remainder of the sub-chunk, exclusive of the ID field and the size field itself. My guess is that if you look there, the ones with the two extra bytes will say that their fmt sub-chunk is 18 bytes long rather than 16 (thanks ooga for catching my error on that).

https://ccrma.stanford.edu/courses/422/projects/WaveFormat/

When there’s a size field, use it. There’s no need to jump to fixed offsets in the file on faith if the file format will tell you how big things are. And if it’s telling you, that’s a strong hint that the size may change.

Ed Plunkett from http://stackoverflow.com/questions/23507953