The cue sheet came from Golden Hawk Technology’s CDRWIN burning software, and the original definition is its user’s guide. No standards body maintains it. This reference draws on the description in Appendix C of the GNU ccd2cue manual and the CueSharp command reference. The commands themselves are on Commands, and their code values on File types, track modes and flags.
General syntax
- Each command takes up one whole line.
- Commands are not case-sensitive.
- Lines may be indented freely, and blank lines are ignored.
- The file holds only commands, their arguments, blank space and line ends.
- A string containing a space must be enclosed in quotation marks.
- The usual extension is
.cue.
The CDRWIN User’s Guide (version 3.8, read as an Internet Archive copy of Golden
Hawk’s cdrwin.pdf) says a cuesheet is “a standard text (ASCII) file”, to be
saved as plain text, with .cue or .txt as the recommended
extensions. It does not name a code page or say what happens to text outside ASCII.
CDRWIN reads the sheet from top
to bottom, and reports the line number of the first syntax error; a single mistyped
character is a compile error. A TRACK command is expected immediately after
its FILE command.
How open readers treat what the guide leaves open (read from their source, and for libcue by running it on test sheets):
| Question | libcue | mpv | CueSharp, ccd2cue |
|---|---|---|---|
| Characters beyond ASCII | Bytes pass through unchanged; a value is kept up to 1,023 bytes (PARSER_BUFFER) | Guesses the character set of the whole file and converts it to UTF-8; reads a Latin-1 line when it is not UTF-8 | Say nothing |
| UTF-8 byte order mark | Not skipped: it prints “bad character” for each of its three bytes and carries on, so the first line still reads | Skipped | Say nothing |
| Line end | Only LF ends a line (a CR is blank space), so a file with CR line ends is one line and is refused | Only LF ends a line | A command takes one line |
| A character it does not know | Prints “bad character” and skips it | A line that starts with an unknown word makes the whole file not a cue sheet | CDRWIN: a compile error at that line |
| Case | Not case-sensitive | Not case-sensitive | Not case-sensitive |
This site reads a file as UTF-8 when its bytes are valid UTF-8, UTF-16 or UTF-32 when a byte order mark says so, and Windows-1252 (Latin-1) otherwise, and says which it chose. Any other mark or encoding is not a cue sheet rule: no source defines one. FFmpeg has no cue-sheet demuxer (its list of demuxers, run here, has none), so it does not read these files by themselves.
Quoting, as libcue reads it: a value in " or ' ends at the
last matching quote on its line, so quotes inside it stay
(TITLE "Op. 66 "Fantaisie-Impromptu"" gives Op. 66 "Fantaisie-Impromptu");
an unquoted TITLE, PERFORMER and the other text commands take the
rest of the line without trailing blanks; an unquoted FILE, CATALOG
or CDTEXTFILE name ends at the first blank; an opening quote with no closing
quote is dropped. No quote escape exists in any source read.
Contexts
A command belongs to one of three contexts and may appear only after its context has been opened.
| Context | Opened by | Commands |
|---|---|---|
| None (disc level) | The start of the file | CATALOG, CDTEXTFILE, TITLE, PERFORMER, SONGWRITER, FILE |
| File | FILE | TRACK |
| Track | TRACK | FLAGS, ISRC, TITLE, PERFORMER, SONGWRITER, PREGAP, INDEX, POSTGAP |
| Any | REM |
TITLE, PERFORMER and SONGWRITER work in the
disc context and the track context, describing the disc or the track respectively.
FILE, TRACK, INDEX and REM may
appear many times in one context; all others at most once.
Order of commands
Within its context, each command must keep to this order.
| Command | Must come after | Must come before |
|---|---|---|
CATALOG | CDTEXTFILE, disc-level TITLE, PERFORMER, SONGWRITER, FILE | |
Disc-level TITLE, PERFORMER, SONGWRITER | CATALOG, CDTEXTFILE | FILE |
FILE | CATALOG, CDTEXTFILE | |
FLAGS | INDEX | |
ISRC | INDEX | |
Track-level TITLE, PERFORMER, SONGWRITER | INDEX | |
PREGAP | INDEX | |
INDEX | FLAGS, ISRC, TITLE, PERFORMER, SONGWRITER, PREGAP | POSTGAP |
POSTGAP | INDEX |
Time values
Times are written mm:ss:ff, in minutes, seconds and frames. There are
75 frames to a second, and each frame is one CD sector. The frame count ends at 74,
and the seconds at 59. An INDEX time is measured from the beginning of
the file named by the current FILE command. Worked example:
03:35:12 is 3 minutes, 35 seconds and 12 frames, which is 16,137 frames,
or 215.16 seconds.
Pregaps and postgaps
| Way of writing it | Audio comes from |
|---|---|
INDEX 00 and INDEX 01 | The file: the pregap’s length is the distance between the two index times. |
PREGAP mm:ss:ff | Nowhere: silence generated when the disc is written. No data is consumed from the file. |
POSTGAP mm:ss:ff | Nowhere: generated, after the track. No data is consumed from the file. |
A pregap on track 1 is how a hidden track before the first track is stored.
CDRWIN’s guide gives the same rules: PREGAP comes after TRACK
and before any INDEX, POSTGAP after all INDEX
commands, one of each per track, and “CDRWIN internally generates” the gap data.
The first index, and several tracks in one file
The CDRWIN guide says “The first index of a track must start at 00:00:00”, says every
time is “relative to the beginning of the current file”, and in every example gives
each FILE one TRACK whose INDEX 01 is
00:00:00. GNU ccd2cue words the same rule for the first INDEX
of a track and, separately, says the time is an offset from the start of the file. The
guide never shows two tracks in one file, so what CDRWIN itself does with that layout is not
stated in the guide. Wikipedia’s article on cue sheets says the format “is designed with the
expectation that all of the audio data exists in a single file (CDRWIN only creates cue sheets
for that kind of rip) or in separate files, but only with the gap portions of the audio either
removed or placed at the beginning of the files”; that is a secondary source, and the guide’s
figures, which have one file per track, are the primary one. Both open readers that were run or read, libcue and mpv, accept it and take
the next track’s INDEX as a later position in the same file, which is the
usual one-file album, and libcue sets a track’s length to the distance to the next
track’s first index (any index number) when both are in the same file.
This site’s reader therefore flags a start other than 00:00:00 only for
the first index after a FILE, where the wording of the guide cannot be
read in two ways. Index times must run forward in the file; a time that goes back is
noted, and a FILE with no track is an error (the guide asks for one track per file).
libcue refuses seconds above 59 and frames above 74 (it drops the whole
INDEX command), so a time written as 00:60:00 gives no index.
The CD-Text file named by CDTEXTFILE
CDTEXTFILE points to a separate file, usually .cdt. The CDRWIN
guide describes how its editor makes the file but not the bytes. GNU ccd2cue’s manual says
the “CD Text Encoding and Decoding Guide” of libcdio documents the CD-Text file format, and
libcdio’s example cdtext-raw.c reads such a file. The data is a run of
18-byte packs (a 4-byte header, 12 bytes of text or binary payload and a 2-byte
CRC) in up to eight language blocks. The CDT pages describe
the packs, the
pack types and the
block size record.
The explorer shows the file
name of CDTEXTFILE and does not open the file it names (a .cdt file
is a separate format from the cue sheet). The same fields can be
given in the sheet itself with TITLE, PERFORMER,
SONGWRITER and the CD-TEXT keywords (table).
The same fields in a FLAC file
RFC 9639 section 8.7 stores a cue sheet inside a FLAC file as a CUESHEET block:
the media catalog number (128 bytes, a 13-digit number for CD-DA), the lead-in length in
samples, a flag for CD-DA, and tracks that each hold an offset, a number (1 to 99, or 170
for the lead-out), a 12-character ISRC, a track type (audio or not) and a pre-emphasis
flag, then index points (the first is 0 or 1, the rest increase by 1, offsets are
multiples of 588 samples for CD-DA). That is CATALOG, ISRC,
TRACK’s type, FLAGS PRE and INDEX of a sheet, at 588
samples (44,100 ÷ 75) to a frame. The block has no titles, no file name, no
PREGAP or POSTGAP, and no DCP, 4CH or
SCMS flag: the block has no field for them.
Examples
REM GENRE Rock
REM DATE 1999
CATALOG 3203040601052
PERFORMER "Artist Name"
TITLE "Album Title"
FILE "Album.wav" WAVE
TRACK 01 AUDIO
TITLE "First Song"
PERFORMER "Artist Name"
ISRC DKKH50800101
FLAGS DCP
INDEX 01 00:00:00
TRACK 02 AUDIO
TITLE "Second Song"
INDEX 00 03:33:12
INDEX 01 03:35:12
INDEX 02 05:10:00
FILE "game.bin" BINARY
TRACK 01 MODE1/2352
INDEX 01 00:00:00
TRACK 02 AUDIO
PREGAP 00:02:00
INDEX 01 58:41:36
Non-standard sheets
Some programs write sheets the CDRWIN manual does not allow (all of this is from Wikipedia’s
article on cue sheets, a secondary source). Exact Audio Copy can
place FILE commands so that the gap audio sits at the end of each
file, which relaxes the manual’s restriction on where FILE may appear, and some
software, foobar2000 among it, does not support that layout. Programs
including VLC and foobar2000 also accept a WavPack or FLAC file marked as
WAVE; EAC writes that too.
Also, REM lines are commonly used for metadata, in forms like
REM GENRE, REM DATE, REM DISCID and
REM COMMENT: libcue reads those and a few more (the
table), and Wikipedia says EAC writes extra fields that foobar2000 can read. The CDRWIN guide
defines none of them. Wikipedia adds that a REM should not appear on a line by itself,
since some applications regard it as a syntax error.