I have come across a wav file that I cannot read using WAV.jl (or LibSndFile.jl). I can open it in about any other audio program or library (Matlab, R, Raven, Audacity, …). If I read it into Matlab and write it back out, then it reads fine with WAV.jl.
I took two files - the original wav file (mdoc) and a version that was read in and then written out using Matlab (mdoc_rewrite) - and tried to find any differences in the files with hexdump. This is the result (*.txt is hexdump output):
$ diff mdoc.txt mdoc_rewrite.txt 1c1 < 00000000 52 49 46 46 14 22 f9 **01** 57 41 56 45 66 6d 74 20 |RIFF."..WAVEfmt | --- > 00000000 52 49 46 46 14 22 f9 **61** 57 41 56 45 66 6d 74 20 |RIFF.".aWAVEfmt | $
I believe positions 5-8 are the file chunk size (little endian) and there is a difference. The file size rewritten from Matlab is correct (if the position 8 value is 61, the chunk correctly corresponds to the wav file size minus 8 bytes).
Was this an incorrectly written wav file? Does it not matter if the file size in the header is incorrect with most programs? Or is there something I’m missing in my understanding of WAV.jl or wav file structure.
Thank you - Robert
Update - I tried putting arbitrary numbers in positions 5-8…matlab still read the file