Lossless audio files can be split by cue file using Ã¢â‚¬Å“shnsplitÃ¢â‚¬Â (part of the Ã¢â‚¬Å“shntoolÃ¢â‚¬Â package). You will also need the Ã¢â‚¬Å“cuebreakpointsÃ¢â‚¬Â tool (part of the Ã¢â‚¬Å“cuetoolsÃ¢â‚¬Â package). To install cuetools and shntool in Ubuntu/ Kubuntu, open a terminal window and enter the following:
apt-get install cuetools shntool
You will also need software for your prefered lossless audio format. For MonkeyÃ¢â‚¬â„¢s Audio you need to install Ã¢â‚¬Å“macÃ¢â‚¬Â Ã¢â‚¬â€œ see here for details. For FLAC and WavPack formats you need to install Ã¢â‚¬Å“flacÃ¢â‚¬Â and Ã¢â‚¬Å“wavpackÃ¢â‚¬Â respectively:
apt-get install flac wavpack
Shnsplit requires a list of break-points with which to split an audio file. Conveniently, cuebreakpoints prints the break-points from a cue or toc file in a format that can be used by shnsplit. You can pipe the output of cuebreakpoints to shnsplit as follows:
cuebreakpoints sample.cue | shnsplit -o flac sample.flac
In this example, a flac file called Ã¢â‚¬Å“sample.flacÃ¢â‚¬Â is split according to the break-points contained in Ã¢â‚¬Å“sample.cueÃ¢â‚¬Â and the results are output in the flac format.
The output file format is specified via the Ã¢â‚¬Å“-oÃ¢â‚¬Â option. If you donÃ¢â‚¬â„¢t specify an output format your split files will be in shntoolÃ¢â‚¬â„¢s default format (i.e., wave files, Ã¢â‚¬Å“wavÃ¢â‚¬Â).
To split a monkeyÃ¢â‚¬â„¢s audio file by cue file and output the results in the flac format:
cuebreakpoints sample.cue | shnsplit -o flac sample.ape
Note that a default prefix Ã¢â‚¬Å“split-trackÃ¢â‚¬Â is used to name the output files. (The default output format is split-track01, split-track02, split-track03, Ã¢â‚¬Â¦). You can specify your own prefix via the Ã¢â‚¬Å“-aÃ¢â‚¬Â option.
To see all the options for shntool split type Ã¢â‚¬Å“shntool split -hÃ¢â‚¬Â or Ã¢â‚¬Å“shnsplit -hÃ¢â‚¬Â.
The audio files output by shnsplit do not contain tag data. However you can use the Ã¢â‚¬Å“cuetagÃ¢â‚¬Â script (installed as part of the cuetools package) to transfer tag data directly from a cue file to your split audio files. You specify the individual audio files corresponding to the tracks contained in your cue file as follows:
cuetag sample.cue split-track01.flac split-track02.flac split-track03.flac split-track04.flac
This will transfer the tag data contained in Ã¢â‚¬Å“sample.cueÃ¢â‚¬Â to the flac audio tracks Ã¢â‚¬Å“split-track01.flacÃ¢â‚¬Â Ã¢â‚¬Å“split-track02.flacÃ¢â‚¬Â Ã¢â‚¬Å“split-track03.flacÃ¢â‚¬Â and Ã¢â‚¬Å“split-track04.flacÃ¢â‚¬Â.
The above command could be streamlined as:
cuetag sample.cue split-track*.flac
Cuetag works with flac, ogg and mp3 files. The cuetag script is not currently able to handle file names containing spaces.
Note: If you are running flac version 1.1.4 or higher then you may need to make some small changes to the cuetag script before it will work correctly with flac files. Open the cuetag script (for Ubuntu installations it will be located at /usr/bin/cuetag) in a text editor and make these two changes: 1) search for the text Ã¢â‚¬Å“remove-vc-allÃ¢â‚¬Â and replace it with Ã¢â‚¬Å“remove-all-tagsÃ¢â‚¬Â. 2) search for the Ã¢â‚¬Å“import-vc-fromÃ¢â‚¬Â and replace with Ã¢â‚¬Å“import-tags-fromÃ¢â‚¬Â.