Here's an article about what a PCM wav file should look like:
https://ccrma.stanford.edu/courses/422/projects/WaveFormat/
Should be able to write a little script of some kind to check out the headers and make sure they look OK.
Update:
http://www.sendspace.com/file/cdy1hk
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://www.etree.org/shnutils/shntool/
This question belongs to http://softwarerecs.stackexchange.com/ - oh but it's too old.
– Daniel W. – 2017-01-02T14:07:20.8131Got a broken file that can be tested upon? – Ignacio Vazquez-Abrams – 2011-05-05T17:28:37.883
@Ignacio: I have some, but it will take some time for me to find them out of thousands of files, which is why I need this in the first place. I'll get back to you if I find one. – paradroid – 2011-05-05T18:42:32.233
You could probably just use dd to cut one short, say the first few tens of kilobytes from a multi-megabyte file. Also, are they all PCM, or do they use other encodings as well? – Ignacio Vazquez-Abrams – 2011-05-05T18:45:56.910
1I wonder if there's something in
shntoolthat may be of use? – boehj – 2011-05-06T18:24:48.010