QutEcoacoustics / baw-workers

Workers that can process various long-running or intensive tasks.
Apache License 2.0
3 stars 0 forks source link

Differentiate "too short" errors when harvesting #63

Open atruskie opened 6 years ago

atruskie commented 6 years ago

There's currently an issue with the Frontier Labs BAR recorders that occasionally causes corrupt WAV files to be produced.

These files aren't detectable by normal means - they are full-size and have a "valid" header. Such files appear to have two things wrong with them:

The likely cause is a sensor running out of battery life and shutting down. Apparently, the files are pre-allocated (hence the empty bytes at the end) and the SubChunk2Size field is written only at the end of the writing process.

The result of the malformed header means that SoX reports absolutely absurd sample rates for recordings (e.g. 5.4 Terasamples per second or 34.4 Terasamples per second) and since it calculates duration from the number of samples / sample rate it fails our too short validation check.

Fix

And a special validation check and error message for this case, so that when harvesting fails, we can reliably understand what the true problem is.