Sunday 8 September 2019

Recovering a corrupted wave file

I was trying to edit a wave file today, but in Audacity it was just silence. In VLC and other audio players when you pressed play it would just stop immediately, as if the file had no length. The file was about 1GB in size, and when opened in a hex editor it certainly looked like it was full of data (i.e. not just NUL bytes).

In researching how to open / recover the file, I found this very helpful video: Fix a Corrupt Wav Audio File in Audacity - Data Recovery Using VLC. The guide there says that in Audacity you need to go to File > Import > RAW. Then to find the settings needed, check the file's properties in VLC.

Unfortunately for me, VLC didn't give any information about the file's properties / codec. I have other WAV files recorded using the same setup, so I loaded one of those into VLC, but it still didn't give any information. Thankfully using foobar (and a previously recorded working file), I did manage to get the required information. (Though it didn't give me the endianess, but there's only 4 different options to try for that anyway).

Whereas in their video an offset of 100 bytes gave them the desired result, I still got static with that offset. But with an offset of 80 bytes, the file imported okay. Initially I thought it hadn't worked, and had just opened the file as silence, but once I Ctrl + F'd to view the full file, I could see it had imported okay, it was just the first minute or so of the file was silence.