Wednesday, 4 February 2009

Tip of the Day: Split APE Files Using a CUE File

APE is a lossless audio format also known as Monkey's Audio. In order to split a big APE file using the information provided in a CUE file, all you will have to do is first to convert it to WAV, and then split the WAV file.

First, install the monkeys-audio package as root:

apt-get install monkeys-audio

This package contains the mac utility, a frontend to the APE codec. Once you installed it, you can use the following command:

mac audio_file.ape audio_file.wav -d

This will decompress audio_file.ape and the result will be a WAV file, audio_file.wav. If you have more than one APE files in the directory and you want to decompress them all, use the commands below:

for i in *.ape; do mac "$i" "$i.wav" -d; done

Next, install the shntool and cuetools packages:

apt-get install shntool cuetools

To split the WAV file, use:

cuebreakpoints audio_file.cue | shnsplit audio_file.wav

That's it. You should now have the desired files splitted and ready to convert them to FLAC or Ogg Vorbis if you want.