Repair a CAF file

Sometimes if the Raspberry PI turn’s off during a recording…the recording could get corrupted. Most often the file can be repaired – because it is only the size description field in the file which has a wrong entry. This can be reset by using the following code – running in a terminal window and at the same directory as the faulty file. (Note please make a copy of your recording file before executing these tasks)

bash

printf '\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF' | dd of=myrecording.caf bs=1 seek=4084 count=8 conv=notrunc

This means: set mChunkSize = -1 of the Audio Data Chunk Data Section. (Meaning the file is unlimited)

Of course, you have to be at the according location of the file „myrecording.caf“ 🙂

And this worked EVERY time with messed up files.

This file was from a Flow 8 with 10 channels.

angr77@angr77:/media/angr77/Recording $ printf '\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF' | dd of=2306110918.caf bs=1 seek=4084 count=8 conv=notrunc
8+0 poster in
8+0 poster ut
8 byte kopierade, 0,00368656 s, 2,2 kB/s
https://developer.apple.com/library/archive/documentation/MusicAudio/Reference/CAFSpec/CAF_spec/CAF_spec.html#//apple_ref/doc/uid/TP40001862-CH210-BCGDCHAA

You can find out more about your recording with “soxi myrecording.caf”

Hope to help,