Tool to display WAVE/AIFF file header information and to restore corrupted WAVE/AIFF file headers.
This program was originally developed to recover damaged audio files which were destroyed due to a bug in the audio application Logic. See this blog post for more details.
Wave Recovery Tool is licensed under the terms of the GNU General Public License Version 3.
Wave Recovery Tool is developed by David Pace <dev@davidpace.de>
To use the wave recovery tool, a Python 3 installation is required.
This tool is capable of reconstructing damaged WAVE and AIFF headers. This will only work if the raw audio data is still in the file, i.e. the file has a reasonable file size in respect to the duration of the recorded audio material (usually several megabytes). In a typical scenario where recovery is possible, one of the following happens when you try to play the audio file:
One or more audio files changed in length.
PATH
variable), then enable it. You might have to look for "customized" or "advanced" options for that. Remember the location where Python 3 was installed.wave-recovery-tool-master
containing the program on your Desktop.Media/Audio Files
. If you saved your project to a .logicx
container, the contents can be shown in Finder by right-clicking the .logicx
file and choosing Show Package Contents.audio
on your Desktop and copy the damaged audio files into that folder. C:\Users\homersimpson
, on Unix-based/Mac systems it is something like /Users/homersimpson
. This directory is sometimes abbreviated as ~
. When a terminal is started, the current working directory is usually your user directory. Enter the command cd Desktop
and hit enter to make Desktop
your working directory. Hint: you can usually use the TAB key to auto-complete the folder names.audio
folder by entering one of the following commands:
python wave-recovery-tool-master\waverecovery.py audio
python3 wave-recovery-tool-master/waverecovery.py audio
command not found
or similar, try replacing python
with python3
and vice versa. If you still get the same error, refer to section Locating Python 3 below.-r
before audio
and add a destination folder (we will call it restored
) after audio. The resulting command lines look like this:
python wave-recovery-tool-master\waverecovery.py -r audio restored
python3 wave-recovery-tool-master/waverecovery.py -r audio restored
restored
on your Desktop and try to restore the audio files from the folder audio
into the restored
folder. Check if the folder was created and whether it contains files. Try playing back the files with a low loudness/volume level, as they might be distorted.-b 24
before audio
.-s 48000
before audio
.-c 2
before audio
.In case you get an error message like command not found
in step 9, you have to replace python
or python3
with the absolute path to your python executable. On Windows, the command line looks like this:
"C:\Program Files\Python\Python37-32\python" wave-recovery-tool-master\waverecovery.py audio
Note that you have to add quotes around the python path if it contains spaces (like in Program Files
). On Unix systems, the command like looks like:
/usr/local/bin/python3 wave-recovery-tool-master/waverecovery.py audio
Of course, you have to replace the python executable paths with the actual paths on your system where Python3 was installed (the path you remembered in step 1 of the step-by-step instructions).
The tool provides two functionalities:
For all commands below, python3
is assumed to be in the system's executable PATH
. If your system reports that python3
can not be found, its containing directory must either be added to the PATH
variable or python3
must be replaced with the absolute path to the Python 3 interpreter. The command python3
must be replaced with python
on some Windows systems. Also refer to the previous section Locating Python 3 if you encounter problems.
Note that on all Windows systems, file system paths are separated with backslashes (\
) instead of slashes (/
).
To display header information for a specific audio file, invoke the tool as follows:
python3 wave-recovery-tool-master/waverecovery.py /path/to/file.wav
The tool can also display audio header information for all files contained in a directory:
python3 wave-recovery-tool-master/waverecovery.py /path/to/directory
All available header fields will be shown. In case a wave file header is damaged, error messages prefixed with [ERROR]
will be displayed. In case size headers (particularly chunk size
and data subchunk size
) are not consistent with the overall wave file size, warnings prefixed with [WARNING]
will be displayed. An example output for a working file looks like this:
Displaying WAVE File Header Data for File MyWaveFile.wav
Number of Bytes: 1371644
Reading WAVE Header...
Chunk Size: 1371636
Skipping JUNK chunk (size: 28).
Reading fmt chunk (size: 16)
Audio Format: 1
Number of Channels: 1
Sample Rate: 48000
Byte Rate (number of bytes per second): 144000
Bytes per Sample in all Channels (Block Align): 3
Bits per Sample: 24
Reading data chunk (size: 1367984).
[WARNING] Data subchunk size does not match file size. Should be 1371572, but is: 1367984 (difference: 3588)
The example output for a damaged file looks like this:
Displaying WAVE File Header Data for File MyDamagedWaveFile.wav
Number of Bytes: 59100494
Reading WAVE Header...
[ERROR] File does not start with 'RIFF' and therefore does not contain a correct wave file header.
This tool is capable of restoring damaged WAVE/AIFF files under the following conditions:
The tool will write a valid WAVE/AIFF file header and append the available raw audio data.
To restore damaged wave files, supply the --restore
(short: -r
) option along with a source and destination path. Source and destination path can either be:
In the second case, the source directory will be scanned for audio files and the restored versions of the files will be saved in the destination folder.
If no further parameters are supplied, the following defaults are assumed:
These values can be changed with the following parameters:
-s
or --sample_rate
-b
or --bits_per_sample
-c
or --channels
Examples are provided below.
Note that on all Windows systems, file system paths are separated with backslashes (\
) instead of slashes (/
).
Restore audio files with
python3 wave-recovery-tool-master/waverecovery.py -r audio restored
Restore audio files with
python3 wave-recovery-tool-master/waverecovery.py -r -b 24 audio restored
Restore audio files with
python3 wave-recovery-tool-master/waverecovery.py -r -s 96000 -b 24 audio restored
Restore audio files with
python3 wave-recovery-tool-master/waverecovery.py -r -s 96000 -b 24 -c 2 audio restored
By default, the tool will only recover files in which errors were detected explicitly. If only warnings were found (indicating only minor inconsistencies) no attempt to recover the files will be made. This might also be the case if the tool failed to detect errors correctly. If the recovery should be attempted nonetheless, the parameter --force
(short: -f
) can be provided as shown in the next example:
python3 wave-recovery-tool-master/waverecovery.py -r -f -s 96000 -b 24 -c 2 audio restored
In some cases the tool requires additional information about the application that originally created/damaged the input file(s). By default, the tool assumes that the files were destroyed by Apple Logic. The tool also supports restoring files destroyed by Ableton Live and a ransomware called Stop/Djvu. To provide information about the application, use the -a
or --application
parameter. The following application names are supported:
-a logic (Apple Logic, default)
-a live (Ableton Live)
-a djvu (Stop/Djvu Ransomware)
Example for Ableton Live:
python3 wave-recovery-tool-master/waverecovery.py -r -s 96000 -b 24 -c 2 -a live audio restored
Example for Stop/Djvu:
python3 wave-recovery-tool-master/waverecovery.py -r -s 96000 -b 16 -a djvu audio restored
Providing the application parameter will aid the tool in computing the correct start and end offsets for the audio data.
If nothing else is specified, the tool will assume that the audio data starts at offset 44 in WAVE files, and at offset 512 in AIFF files. If the audio data starts at a different offset, it can be specified using the -o
or --offset
parameter.
Similarly, a custom end offset can be specified. If no end offset is given, the data will be copied until the very end of the input file. Use the parameter -e
or --end_offset
to specify a custom end offset.
Offsets must be specified as integer value. It is also supported to supply negative integer values. In this case the offset will be interpreted as a position relative to the end of the file.
For example, the following command line will copy audio data starting at offset 153608
until 334
bytes before the end of the file:
python3 wave-recovery-tool-master/waverecovery.py -r -s 96000 -b 24 -o 153608 -e -334
If this wave recovery tool helped you to restore your damaged audio files, I would appreciate a donation at https://www.paypal.me/davehofmanndev. Thank you very much!