[Flac] FW: Odd number of samples in a stereo wave file

Ben Yarwood ben.yarwood at juno.co.uk
Thu Nov 15 12:43:49 PST 2007


I'm new to the mailing list but am interested in picking up a thread from earlier in the month but which I thought had become
confusing so I am starting again.  I should admit from the beginning that I am a colleague of Alex Brims who started the original
thread.

The thread in question related to a wav file with an extra two bytes at the end causing a partial sample error in the reference flac
encoder.  There seemed to be confusion over what was actually wrong with the file but as Brian Willoughby deduced correctly, the
file had an odd number of samples in the data chunk and as it was a stereo file, this was incorrect.  

What I am asking is does this make the file invalid as far as the RIFF\WAVE specification goes? The file had a valid "RIFF", "fmt "
and "data" chunks as far as chunk Id's and lengths where concerned and the overall file length is correct. The only issue is that
the "data" chunk started and ended with a sample from the same channel.  I have read through some of the documentation provided at
http://www.ambisonia.com/Members/mleese/file-formats/ and especially the McGill university WAVE specification and the Microsoft/IBM
documentation and can't find anywhere that it says that there needs to be an even number of samples, just that they need to be
interleaved.  I may have missed something along the way in which case the simple answer to the original question is "yes the file is
invalid." That's fine with me. 

The main reason to bring this up is to point out that these files exist and in our experience are quite common, of the hundreds of
new wav files we receive a day around 1% seem to have this problem.   We receive them from many different suppliers and they seem to
becoming more common, which is a bit of a pain and probably down to an update to a particular piece of software.  Fixing them is
also not particularly complicated, either add a sample or remove the last one and update the relevant chunk information.  On the
other hand it seems a little punitive to error on a file in this situation.

Anyway your thoughts or opinions would be appreciated.  If I have totally misunderstood something in putting this mail together then
I apologize in advance.


Ben


  







More information about the Flac mailing list