Looking for a Linux or Windows command line .WAV file checker

I am trying to find a command line program (Windows or Linux) that can check .WAV files, to see if they are complete, with no corruption or sudden endings.

While I have found several programs that can do this with .mp3 files, I cannot find anything that can do it with .WAV files, apart from a couple of commerical Windows programs that only use a GUI and so cannot be used in scripts.


Here's an article about what the wav format spec looks like:

http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html

Should be able to write a little script of some kind to check out the headers and make sure they look OK.

Update:

https://github.com/mbs/wavcheck/releases/tag/0.1

Here's a small utility that may suit your need. It checks the file, outputs some information on the file, and exits. The return code is 0 if successful, nonzero if there's a problem with the file.

It is written in Python and depends on the Python wave library. You can extract the .py file from the zip and examine/run independently, or use the compiled exe along with the support files included.

Seems to work OK for e.g. files output by lame --decode, and catches when I truncate a WAV (checks to make sure the file size is sane).

There is no way to determine if the PCM data has been corrupted without e.g. external checksums, etc.

Update:

Added a bit better error checking. Compiled exe version freaks out when wavcheck.py is in the same folder, so I stuck it in a subfolder (/src). Lol. Updated link above to new file.

Update:

I took a look at shntool as suggested by @boehj -- looks like good software for checking WAV files, and it has nice detailed output. Its output could be trivially parsed or its source code modified to allow for an all-OK exit status in 'info' and/or 'len' mode. As it stands, it has exit code 0 even when it is reporting problems with the file.

Homepage for shntool: http://shnutils.freeshell.org/shntool/

Update: Since everything in this post was stale for years, I linked to a different article about the wav format, and uploaded the code I wrote and compiled software to github, and updated the link to point to it. Tested the software in Win10 and it does seem to still work on basic LPCM wav files. Doesn't seem like shntool exists at the original link anymore, so I fixed that to point somewhere too, but couldn't tell for sure if it's definitive.


Ripcheck is a utility that does this.

Quoting the docs:

"ripcheck" runs a variety of tests on a WAV file, to see if there are potential mistakes that occurred in converting a CD to a WAV file.

[...]

WHY?

This program was written because we'd received some complaints of occasional "pops" at the beginning on some albums at Magnatune. Further research found that most of the albums we released in 2007 had various CD ripping problems. We also found various CDRs burned by our musicians that had small defects in them, probably due to cheap CDR media being used, or the CDR being burnt too quickly.

[...]