Sunday, October 31, 2010

Splitting CUE/APE files

Once more another unusual file format. This time it's a single large .ape file with accompanying cue sheet. Based on a bit of Googling, it seems I need to compile and install Monkey's Audio Codec (mac) because there's no available package in the Ubuntu repositories.

Attempts to compile failed for me. I just get some compile errors about invalid casting which I'll assume is a bug in the source code for now. In the mean time, I'll use the following workaround.

First, convert the .ape file to an equivalent .flac format. Both are lossless formats so there's no loss of audio quality involved.

Sound Converter
If you haven't already, install Sound Converter from terminal:

~$ sudo apt-get install soundconverter

I made use of sound converter to convert the .ape file to .flac format. Sound Converter creates subfolders in ~/Music by default, so copy the resultant .flac file over to where your cue sheet is.

The rest will be basically the same as splitting a .flac file with cue sheet into individual tracks. I'll reproduce the steps here for ease of reference:

~$ sudo apt-get install cuetools shntool
~$ cuebreakpoints "filename.cue" | shntool split -o flac "filename.flac"

shntool will output the individual audio tracks as split-track01.flac, split-track02.flac, and so on. At this point, you're basically done already. Just rename the tracks as desired.

Adding tags from the cue sheet

Cue sheets normally include track info which shntool doesn't automatically add for you. The cuetools package includes a tool for doing this:

~$ cuetag "filename.cue" split-track*.flac

Any tag info available on the cue sheets will be added into the individual tracks.

Related posts:

Splitting CUE/FLAC files
Dealing with UIF files