Alternative recovery tool
Posted: Thu Sep 12, 2013 12:30 pm
Hello,
Yesterday I recorded an interview, but I shut down my laptop before audacity was finished saving.
I noticed a lot of .au files were present, but the .aup file was empty. So, I decided to try to recover this.
I found the recovery tools on the wiki, but these seemed unnecessary complex (read all .au files, convert and append to one .wav file, ...).
I realized the only thing I need is to recreate the .aup index file, which is in XML format.
Find my python script for recovery attached here.
Notice, it was written purely to recover my interview, based on the .aup files for similar interviews I had done with the same settings. So, a lot of the data in the XML file is hardcoded to those values.
Some description / documentation:
create_aup() is the main function, it requires a directory name and a project name.
=> at the end, it will generate the file "<directory>project.aup"
=> list all files which match the pattern "<directory><project>_datae*d**.au"
=> sort by last-write / modification time
=> split in odd/even list (left/right channel)
=> add the audacity XML beginning structure
=> add wavetrack for left channel
=> add wavetrack for right channel
=> add the audacity XML ending structure
for each wavetrack, I do the following:
=> try to add the .au from the correct channel
=> if that fails, try to add the .au from the other channel
=> if neither channel has a good .au file, just skip this part (there will be 6 seconds missing)
This approach is good enough for me, but ofcourse the result is not perfect:
--> When listening with a headphone I can clearly hear sometimes when one of the speakers jumps from one channel to the other channel.
--> Some parts were missing in both channels, so here and there 6 seconds are skipped (they are NOT replaced by silence).
Why I like it better than the alternatives (creating a .wav file):
--> You can just open the .aup file directly in Audacity, without having to fiddle with 2GB big .wav files
--> It uses almost no memory, is very fast, doesn't write much to the harddisk, should be able to handle any size of data.
--> It uses only 3 standard python libraries : glob, os, struct. No other dependencies.
Probably this can help some other people as well.
Yesterday I recorded an interview, but I shut down my laptop before audacity was finished saving.
I noticed a lot of .au files were present, but the .aup file was empty. So, I decided to try to recover this.
I found the recovery tools on the wiki, but these seemed unnecessary complex (read all .au files, convert and append to one .wav file, ...).
I realized the only thing I need is to recreate the .aup index file, which is in XML format.
Find my python script for recovery attached here.
Notice, it was written purely to recover my interview, based on the .aup files for similar interviews I had done with the same settings. So, a lot of the data in the XML file is hardcoded to those values.
Some description / documentation:
create_aup() is the main function, it requires a directory name and a project name.
=> at the end, it will generate the file "<directory>project.aup"
=> list all files which match the pattern "<directory><project>_datae*d**.au"
=> sort by last-write / modification time
=> split in odd/even list (left/right channel)
=> add the audacity XML beginning structure
=> add wavetrack for left channel
=> add wavetrack for right channel
=> add the audacity XML ending structure
for each wavetrack, I do the following:
=> try to add the .au from the correct channel
=> if that fails, try to add the .au from the other channel
=> if neither channel has a good .au file, just skip this part (there will be 6 seconds missing)
This approach is good enough for me, but ofcourse the result is not perfect:
--> When listening with a headphone I can clearly hear sometimes when one of the speakers jumps from one channel to the other channel.
--> Some parts were missing in both channels, so here and there 6 seconds are skipped (they are NOT replaced by silence).
Why I like it better than the alternatives (creating a .wav file):
--> You can just open the .aup file directly in Audacity, without having to fiddle with 2GB big .wav files
--> It uses almost no memory, is very fast, doesn't write much to the harddisk, should be able to handle any size of data.
--> It uses only 3 standard python libraries : glob, os, struct. No other dependencies.
Probably this can help some other people as well.