CUE sheets processing

What is a CUE sheet?

CUE sheets are used to provide index and playlist information for a large audio file. They are generally used in conjunction with either extracting from, or burning to, music audio CD. CUE sheets have the file extension *.cue, and are simple plain text files.

The CUE sheet may contain metadata information (e.g.: TITLE and PERFORMER statements), but must contain information regarding the file(s) referenced by the CUE sheet (FILE command) and the TRACK and INDEX points within the file. INDEX points are specified using the MM:SS:FF format, where MM is the number of minutes, SS the number of seconds, and FF the number of frames (there are seventy five frames to one second).

Why Totalamp analyzes CUE files?

Totalamp creates subtracks from them, so that you can create playlists from individual tracks (single audio file is chunked into smaller pieces according to CUE information), see CUE information.

Example of typical CUE sheet file content

When Totalamp analyzes CUE files?

Basically there exist two scenarios when CUE files are analyzed:

Totalamp analyzes CUE files when performing database update. For more information, see Database update process in detail.

You can also analyze CUE file when you manually edit subtracks of specified track, see Subtracks information window.

Which CUE files and their tracks are valid?

In subtracks information window, you can open any file (even extension other than CUE). The file can have any name, and file references in CUE file are ignored, i.e., every music file reference is accepted. There are two post conditions, they are always applied, also during database update:

(1) If there is only one track in CUE file, it will not be displayed (as if the file is empty). It makes no sense to have one subtrack representing the whole audio file.

Example:

CUE file containing only one track

(2) If there are more tracks, and if some of them intersects with the first one, the CUE file is rendered invalid.

Example:

CUE file containing track which intersects with the first track

During database update, the situation is more complicated. The problem is that many variables are part of the game: music file, CUE file(s), CUE referenced file(s), number of music files, number of CUE files in directory.

Situation 1 – Identical filenames

Note: case is always ignored, i.e., abc.CuE is OK when you play aBC.mP3.

If you play abc.mp3 and file abc.cue exists in the same folder, it is parsed and reference inside it is irrelevant. Algorithm reads the tracks in CUE file and creates subtracks in the database. Again, postconditions are applied. It might happen (but it usually should not) that two physical files are referenced inside CUE. In that case, the file would be invalid, because the first track of first referenced file probably intersects with the first track of the second referenced file.

Situation 2 – Identical prefix

If you play abc.mp3 and abc.cue is not found, the algorithm tries to find any file like abc*.cue.

If such file exists, the file is analyzed. Inside CUE, the file references are analyzed.

If the music file is identical to the reference file, it is OK, tracks are analyzed.

If the music file is not identical to reference file (e.g. abc.flac and CUE file is referencing to abc.wav), if there is only one CUE file in the directory, and if the reference file without extension equals music file without extension, then tracks are analyzed.

The last chance is that there is only one music file in the directory, then the CUE reference is ignored, and the file is analyzed.

Situation 3 – Any CUE file

Algorithm checks any CUE file in the directory. If reference matches, tracks are analyzed.

If the music file is not identical to the reference file (e.g. abc.flac and CUE file is referencing to abc.wav), if there is only one CUE file in the directory, and if the reference file without extension equals music file without extension, then tracks are analyzed.

The last chance is that if there is only one music file and only one CUE file in the directory, then the CUE reference is ignored, and the file is analyzed.

Note: conditions in situations 2 and 3 are there because of unwanted assignments of subtracks and duplicities. If there are several FLAC files and several CUE files in one directory, it is not that straightforward how to analyze them. On the other hand, we want to automate and get as many relevant CUE files as possible. If there is a single file abc.flac and a single file def.cue, chances are that this CUE file belongs to that FLAC file.

How are the track indices parsed?

INDEX 01 always defines START of the current track.

INDEX 00 (if different to INDEX 01), is used as END time of the previous track.

If INDEX 02, 03, etc. is found, then the current track END time will have this value (the last one related to the track, e.g. if there is INDEX 05 and after that goes INDEX 03 for whatever reason, the end of this track will be specified by INDEX 03).

Indices example

Indices (another example)

End time of the last track cannot be determined from CUE, it is taken from the audio file.

Other parameters like PREGAP, DCP... are ignored.

If non-compliant file is found, it usually ends up with error (like track 01 and track 02 intersection). The problem is usually the order of commands. The FILE command must be the first one, as described in the specification. The only way is to edit the file manually according to specification rules.

Examples:

Non-compliant CUE file containing several music files. FILE commands are in incorrect lines.

CUE file containing two music files

Result in Totalamp (subtracks under main tracks)

And... that’s it, that’s how CUE files work in Totalamp.

Classic version is required to fully enable CUE sheets functionality.

See also How to create your first subtrack

See also Subtracks information window

See also Subtracks playback

See also CUE information

Back to contents