-
Notifications
You must be signed in to change notification settings - Fork 35
Description
I have come across a wav file that I cannot read using WAV.jl (or LibSndFile.jl). However, I can open it in about any other audio program or library (Matlab, R, Raven, Audacity, …) that I have tried. If I read the wav file into Matlab and just write it back out, then it reads fine with WAV.jl. This later process seems to correct the reading issue using WAV.jl.
I compared the problem wav file with a corrected version created by reading into matlab and writing back out. I am calling the original wav file "mdoc" and the corrected version "mdoc_rewrite". I looked for differences using 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). I've also tried putting arbitrary numbers in positions 5-8…matlab can still read the file.
Is this an issue with WAV.jl or 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