This post is about a serious bug in Logic, which causes audio files to be damaged. The symptom of this bug is the following error message when opening a previously perfectly working project:
One or more audio files changed in length.
This is how I encountered the bug: we had recording sessions with our band and had completed the first session. After some time, when our sound engineer opened the project again, he encountered the error message above for some files. After listening through the projects, he discovered that a large number of audio clips could not be played back anymore. We had one backup of the project we had made right after the recording session, but unfortunately it contained the same corrupted files. This meant that we had to repeat the recording session 🙁
We had some more recording sessions, after which we made 3 or 4 backups right away. After we had recorded a whole album, the issue occurred again. The files were corrupted on all backups again. Then, our sound engineer noticed the following: when he opened a project for the first time, logic reported 4 corrupted files. When opening the same project again, suddenly 24 files were corrupted. This leads to the conclusion that Logic itself is responsible for destroying the audio files.
Logic destroys the audio files in seemingly random order, e.g. in a sequence of 79 audio files recorded for one track the files with numbers 43, 48, 56, 58, 59 and 74 were corrupted. According to internet sources, the bug occurs under the condition that the computer utilizes differently formatted hard disks, i.e. disks which are not all formatted with Mac OS X Journaled. This bug occurs when logic is closed, which means that even if the project perfectly works before closing the program, there is no guarantee that it will work when opened again!
For a more thorough analysis, I compared working files with corrupted files using a Hex editor, in which each single byte in the file can be visualized. The first bytes of an intact wave file look like this:
For a detailed description of each byte, refer to this page. In short, these are the contents of the wave file header:
- Bytes 1-4: RIFF chunk descriptor
- Bytes 4-8: chuck size (total number of bytes in the file after this block)
- Bytes 8-12: format (in this case WAVE)
- Bytes 12-16: fmt-subchunk header (contains “fmt “)
- Bytes 16-20: subchunk size (in this case 16 for PCM)
- Bytes 20-22: audio format (1 = PCM)
- Bytes 22-24: number of channels (1 = Mono, 2 = Stereo, etc.)
- Bytes 24-28: sample rate
- Bytes 28-32: number of bytes for one sample in all channels
- Bytes 32-34: resolution in bits per sample, etc. 8, 16 or 24 bits
- Bytes 34-36: reserved
- Bytes 36-40: data chunk header (contains “data”)
- Bytes 40-44: number of bytes for the raw audio data
- Bytes 44ff.: raw audio data
Now let’s have a look at a destroyed audio file:
If the bug occurs, Logic fails to write the wave header correctly. Instead, the file contains only zeroes in the first 44 bytes, which is exactly the length of the wave header. The raw audio data, starting at byte 45, is still intact (note that the hex editor starts counting at 0).
If such a corrupted wave file is opened, logic can’t read the header and assumes a default 8 bit setting, which leads to a misinterpretation of the audio data. Additionally, the length of the file will also be misinterpreted, because a wrong sample rate is assumed.
Repairing the Audio Files
You can restore the destroyed files by copying a wave file header from a correct file (with matching sample rate and resolution) to a corrupted file in the hex editor. For example, wave files with a sample rate of 44.100 Hz and 24 bit resolution need to start with bytes similar to these (in hexadecimal representation):
52 49 46 46 5B 89 3E 00 57 41 56 45 66 6D 74 20 10 00 00 00 01 00 01 00 44 AC 00 00 CC 04 02 00 03 00 18 00 64 61 74 61 6B 5C 3E 00
One potential issue now could still be that the chunk sizes (bytes 4-8 and 40-44) are not correct, but most audio editors don’t check these values. If you want to correct these as well, make sure that you use the correct little endian representation for these byte groups.
This post reveals a serious bug in Logic, which can potentially destroy hours and weeks of hard work. Fortunately, the data can be restored completely. I seriously hope that this bug will be fixed soon or is already fixed. We experienced these problems with Logic 9, but internet forum posts suggest that it can also happen with Logic Pro X. If someone can confirm or has any updates, please feel free to comment. Please also comment if you know an audio editor which can restore the wave header including the correct chunk sizes.