Skip to content
This repository has been archived by the owner on Jun 10, 2020. It is now read-only.

Differentiate "too short" errors when harvesting #63

Open
atruskie opened this issue Dec 20, 2017 · 0 comments
Open

Differentiate "too short" errors when harvesting #63

atruskie opened this issue Dec 20, 2017 · 0 comments

Comments

@atruskie
Copy link
Member

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 Subchunk2Size field (offset at byte 40) in the WAV header is set to
    0x0000002c (44 decimal) when it should be much much larger
  • And each of the files seems to be only partially written - after some
    point only empty bytes (NULs / zeroes) are present in the file

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant