(Though this article will still be useful to some, most users will prefer my updated article here.)
It may come to pass that you download a concert or album only to discover that the encoder has helped you out by encoding the entire thing as a single FLAC file accompanied by a .cue file for determining the track changes. Rhythmbox, for instance, will play these large FLAC’s just fine and it will even display the correct track information as you progress through the file. However, I find it much more palatable to have single tracks be single files.
It’s actually pretty easy to break that large FLAC file into its component tracks and to add the appropriate tag information into those individual FLAC files. It only requires a couple of lines of code, in fact. The code may look complicated, but once you understand how to parse the different pieces you should have no difficulty in manipulating the code to process your files.
Before you begin with that you will want to add two utility packages which contain the tools you will need to make these splits and do the tagging of the individual files. Open a terminal (Applications —> Accessories —> Terminal) and run these two commands:
sudo apt-get install shntool sudo apt-get install cuetools
It doesn’t matter in which order you run them but you will need both packages.
First I offer a couple of examples of how the code might look. Suppose you have a folder which contains a Van Morrison album as a single flac (and the cue file is in there as well). In your terminal (Applications —> Accessories —> Terminal) navigate into that folder (using the cd command). Your commands might look like such:
## Two commands as an example # shnsplit -o flac -f "Van Morrison - Astral Weeks.cue" -t "%n – %t" "Van Morrison - Astral Weeks.flac" cuetag "Van Morrison - Astral Weeks.cue" 0*.flac #
As I said, the code looks a little complex but let’s look at another example. Suppose you have volume one from the Hôtel Costes series by Stéphane Pompougnac. Your code might look like this:
## Two commands in a different example # shnsplit -o flac -f VA-Hotel_Costes_1.cue -t "%n – %t" VA-Hotel_Costes_1.flac cuetag VA-Hotel_Costes_1.cue *.flac #
As you can see, certain elements do not change. What changes is your particular file names. In the Van Morrison example the files contain spaces and said spaces must be preceded by a slash in order to be taken as a space within the file name (or you must quote the entire file name). In the end what you are really seeing is this (the square brackets are only there to remind you what needs replacing):
## More examples for better understanding # shnsplit -o flac -f [cuefile].cue -t "%n – %t" [albumflac].flac # OR shnsplit -o flac -f "cue file.cue" -t "%n – %t" "album flac.flac" # OR shnsplit -o flac -f cue\ file.cue -t "%n – %t" album\ flac.flac cuetag [cuefile].cue *.flac # &c #
I like to change both my FLAC and cue files to the name a. Also, you may or may not want to add the name of the performer in your file names. (I only include the performer names on various artist albums. So you know, %a is for Album and %p is for performer.) Then I can simply run (no slashes; no quotes around the file names):
## Choose one of these first two ## Then run the last shnsplit -o flac -f a.cue -t "%n – %t" a.flac # OR shnsplit -o flac -f a.cue -t "%n – %p – %t" a.flac cuetag a.cue *.flac #
(Be sure to either send the album FLAC to the trash or change its file extension after running the first command but before running the second, or you will get an error about having the wrong number of FLAC files.)
Let me explain that zero (0) in the Van Morrison example. That album happens to have fewer than 10 tracks. So all of the tracks begin with a zero (01, 02, &c). That is not the case on the Hôtel Costes album; it has tracks 11, 12, 13, &c. You must add something like .remove to the album FLAC (so VA-Hotel_Costes_1.flac.remove) or move to different location (like the trash) after you have run the first command and before you run the second command (since the album FLAC file also ends in .flac and would be within the scope of *.flac). If you leave the original FLAC within range, cuetag will inform you that the number of tracks does not match the number of cue breaks and it will not tag the files. Not a big deal, but it could be a point of confusion if you were not prepared properly for it.
There are other arguments besides those which I used in my commands above. You can read quite a lot about similar methods here.
Happy hunting, music lovers.