david-pace / wave-recovery-tool

Tool to display WAVE/AIFF file header information and to restore corrupted WAVE/AIFF file headers
GNU General Public License v3.0
14 stars 2 forks source link

UnicodeDecodeError on AIFF restore #2

Closed jokroese closed 4 years ago

jokroese commented 4 years ago

I am trying to restore an AIFF file on macOS Catalina but having a few issues.

  1. Running python3 -r wave-recovery-tool-master/waverecovery.py audio restored gave me the error Unknown option: -r
  2. Changing the position of -r to give python3 wave-recovery-tool-master/waverecovery.py -r audio restored gets around that but then I'm getting an error saying
    Creating destination directory restored...
    Scanning directory audio...
    ------------------------------------------
    waverecovery.py: UnicodeDecodeError('utf-8', b'\x15\xbd\xd2U', 1, 2, 'invalid start byte')

Do you have any thoughts about how I can get around this problem?

Thank you!

david-pace commented 4 years ago

The position of -r indeed should be after waverecovery.py. This is correct in the examples further down in the readme, but I should fix this in the step-by-step instructions.

The error indicates that the AIFF chunks are not located in the file where wave recovery tool expects them to be. Would it be possible to send me one of your files via e-mail so I could look into the problem?

ericshuk commented 4 years ago

Hey @davehofmann , I've ran into the same error coincidentally. It doesn't output at exactly which file the error is being thrown in so I had to go one by one. I managed to track down a few specimens for you. Here is the file -> failed.zip

python3 waverecovery.py -r -b 24 ~/Desktop/tmp ~/Desktop/restored

Thanks for having a look. Your tool has helped greatly already!

jokroese commented 4 years ago

Thanks for your response.

I have uploaded the file here. It’s quite long as it’s from a set I forgot to stop recording - oops!

Let me know if I can do anything else to help.

david-pace commented 4 years ago

Hi guys, I was able to fix the UnicodeDecodeErrors. You can try restoring the files again with the new version.

Unfortunately, when I tried repairing your files I did not get reasonable results. Could you please specify which settings were used when the files were recorded (sample rate, bits per sample and number of channels)?

jokroese commented 4 years ago

I tried again and didn't get the error so that's good!

Also, by putting in the recordings settings (stereo, sample rate: 44.1 kHz, bits per sample: 32) I got some recognisable sound out.

Unfortunately, the restored recording is 1) distorted and 2) shorter than I would expect. On 2), from the size of the AIFF file I am trying to restore, as well as knowing when the recording abruptly stopped, I expected it to be over 20 minutes long. Instead, the recovered recording is 6:21. This may be from the way the recording was abruptly ended and nothing to do with the wave recovery tool. However, if you have any thoughts, I'd be happy to hear them! Thanks

david-pace commented 4 years ago

@joekroese did you record this file with Logic? If so, which version was used? In the header I see that this is an AIFC file (as opposed to AIFF). It could be the case that the wave recovery tool does not handle AIFC well, but I could look into it and enhance it once I have some free time.

Another interesting characteristics of your file is that is contains numerous blocks which contain lots of repeating byte sequences. I'm not 100% sure, but this quite unusual for PCM data and it might indicate that there were I/O errors while the file was written, in which case the file can not be recovered.

@FullyFerret if I understand correctly, some files could be recovered and some not. Would it be possible to get a "recoverable" file for comparison?

jokroese commented 4 years ago

@davehofmann I recorded it with SuperCollider, which might explain some of the problems and why the wave recovery tool struggles with it. I hadn't noticed that it was AIFC actually - good spot! Maybe the compression codec does something strange to it. For the repeating sequences, it is quite repetitive electronic music but that might not be enough to explain it!

If you end up spending any extra time on the tool to support AIFC, I'd be interested to see if the recording is recoverable. Otherwise, I recorded my set with an external microphone too so all is not lost. Thanks again for your help!

david-pace commented 4 years ago

Since this issue orginally was created for UnicodeDecodeErrors, I adjusted the title a little bit and will close the issue because it was resolved already. I created #3 to track AIFF-C support as requested by @joekroese. Feel free to open new issues if anything else does not work or should be enhanced.