CUE2TOC(1)

๐Ÿ“ฆ
version 1.2.6 ยท 2 versions
, in alpine 3.24, arch rolling, epel 9, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0

๐ŸŒธ NAME ๐ŸŒธ

okay so bestie, meet cue2toc โ€” it's a section 1 (General Commands Manual) girlie and her whole job is converting CUE to TOC format. that's it, that's the gig ๐Ÿ’…


โœจ SYNOPSIS โœจ

cue2toc [-hnqv] [-o tocfile] [-w wavefile] [cuefile]

๐Ÿ’– DESCRIPTION ๐Ÿ’–

so cue2toc takes cuefile, converts it from CUE format into TOC format, and drops the result into tocfile. simple as that ๐Ÿซถ

and here's the cute part: if you leave out cuefile or tocfile โ€” or you just hand it a single dash "-" โ€” then cue2toc reads from standard input and writes to standard output respectively. yes queen, pipes work ๐ŸŒˆ

CUE files are text files that describe the layout of a CD-Rom, and they typically carry the extension ".cue".

now let's talk about cdrdao for a sec, because context is everything. cdrdao is a CD-burning application and it has its own native TOC format for describing disc layout. and yes, cdrdao does have direct support for reading CUE files, but ngl it's currently limited to data tracks only ๐Ÿ˜ญ. so the entire point of cue2toc โ€” her main usefulness, her moment, her era โ€” lies in converting CUE files that contain audio tracks.

also! output of CD-Text data can be disabled with the -n option. noted ๐Ÿ“

CUE files often come with MP3 files, but since cdrdao doesn't support decoding them on the fly, they probably must be decoded by other means prior to writing the CD (e.g. using lame). for this reason you can specify a filename with the -w option, and it'll be used for all audio tracks instead of the one in the CUE file. of course this is only really useful if all the tracks are based on the same file โ€” but lowkey that seems to be the case quite often. so, win ๐Ÿ’…

cue2toc normally displays warning messages for unsupported commands and constructs. the -q option disables these warnings. silence is golden, etc etc โœจ


๐ŸŽ€ OPTIONS ๐ŸŽ€

  • -h โ€” print a short help message ๐Ÿ†˜
  • -n โ€” no CD-Text; disable output of CD-Text information ๐Ÿ™ˆ
  • -o tocfile โ€” write result to tocfile instead of standard output ๐Ÿ“ค
  • -q โ€” quiet mode; do not print warnings ๐Ÿคซ
  • -v โ€” print version number ๐Ÿ‘‘
  • -w wavefile โ€” use wavefile for all audio tracks ๐ŸŽต

๐Ÿฆ‹ CUE FORMAT ๐Ÿฆ‹

what follows is a description of the CUE format expected by cue2toc. for info about the TOC format please consult the cdrdao(1) manual page โ€” that's her house, not mine ๐Ÿ 

CUE files consist of commands and their arguments, and those must be separated from each other by any number of whitespace characters. space, horizontal tabulator, newline and carriage return are all recognized as whitespace characters โ€” except inside strings surrounded by double quotes, where they are part of the string. commands are not case sensitive. and CD-Text data can be at most 80 characters per item. that's the limit, don't push it ๐Ÿ’€

Timecode values are accepted in the forms "X:X:X", "X:X" and "X" where each "X" must consist of at most two digits and may be zero padded to the left. they are interpreted as "M:S:F", "S:F" and "F" respectively, where "M" means "minutes" and must be in the range 0 <= M <= 99, "S" means "seconds" and must be in the range 0 <= S <= 59, and "F" means "frames" and must be in the range 0 <= F <= 74. math girlies rise ๐Ÿงฎ

CUE files are logically divided into a global section and one to 99 track sections. inside these sections the following commands are allowed:

๐ŸŒ Global Section ๐ŸŒ

REM anything_to_newline
CATALOG string
CDTEXTFILE string
TITLE string
PERFORMER string
SONGWRITER string
FILE string BINARY|MOTOROLA|AIFF|WAVE|MP3
  • REM โ€” Optional. introduces a comment. anything from there on up to and including the next newline character is ignored. comments can appear anywhere in the file but not between a command and its arguments. don't be messy bestie ๐Ÿšซ
  • CATALOG โ€” Optional. the Media Catalog Number of the disc. must be exactly 13 characters. not 12, not 14. thirteen. ๐Ÿ“
  • CDTEXTFILE โ€” Optional. specifies an external file containing CD-Text data. ignored. yeah, ignored. she said what she said ๐Ÿ™ˆ
  • TITLE โ€” Optional. the CD-Text title of the disc ๐ŸŽ€
  • PERFORMER โ€” Optional. the CD-Text performer of the disc ๐ŸŽค
  • SONGWRITER โ€” Optional. the CD-Text songwriter of the disc โœ๏ธ
  • FILE โ€” Required. the name and type of the file to be used for all following tracks. the string contains the name of the file followed by one of BINARY, MOTOROLA, AIFF, WAVE or MP3. as far as cue2toc is concerned the type of the file is effectively ignored. nonetheless MOTOROLA, AIFF and MP3 cause printing of a warning message, since these file types can not be used directly with cdrdao โš ๏ธ

the first appearance of a TRACK command causes leaving of the global section and entering the track section. bye global era ๐Ÿ‘‹

๐ŸŽง Track Section ๐ŸŽง

TRACK number mode
REM anything_to_newline
FLAGS [DCP] [4CH] [PRE] [SCMS]
ISRC string
TITLE string
PERFORMER string
SONGWRITER string
PREGAP timecode
INDEX number timecode
POSTGAP timecode
FILE string BINARY|MOTOROLA|AIFF|WAVE|MP3
  • TRACK โ€” Required. starts a new track definition. the number is ignored. the mode must be one of AUDIO, MODE1/2048, MODE1/2352, MODE2/2336 or MODE2/2352 ๐ŸŽš๏ธ
  • FLAGS โ€” Optional. defines the flags for this track. must be followed by one or more of the following commands: DCP (digital copy permitted), 4CH (four channel audio), PRE (pre-emphasis enabled) and SCMS (serial copy management system). SCMS is ignored because there is no corresponding option in the TOC format ๐Ÿšฉ
  • ISRC โ€” Optional. the International Standard Recording Code for this track. must be exactly 12 characters long ๐Ÿท๏ธ
  • TITLE โ€” Optional. the CD-Text title of this track ๐Ÿ’–
  • PERFORMER โ€” Optional. the CD-Text performer of this track ๐ŸŽ™๏ธ
  • SONWRITER โ€” Optional. the CD-Text songwriter of this track โœ๏ธ (yes, that's spelled SONWRITER in the track section. not me, her. keep it exactly like that iykyk ๐Ÿ’€)
  • PREGAP โ€” Optional. the length of the track pregap to be filled with zero data. mutually exclusive with INDEX 0 ๐Ÿšซ
  • POSTGAP โ€” Optional. the length of the track postgap to be filled with zero data ๐Ÿ•ณ๏ธ
  • INDEX โ€” Optional. the number must be in the range 0 <= number <= 99. index number 1 specifies the start of the track. index number 0 is the start of the track pregap filled with data from the file โ€” i.e. the difference between index 0 and index 1 is the length of the pregap. index 0 is mutually exclusive with PREGAP. index numbers greater than 1 specify subindexes for this track and must be sequential ๐Ÿ”ข
  • FILE โ€” Optional in track section. the syntax is the same as described above, and if it appears inside a track specification it takes effect on the next TRACK command โญ๏ธ

โš ๏ธ LIMITATIONS โš ๏ธ

the command CDTEXTFILE and the flag SCMS have no equivalent in the TOC format and are ignored. no cap, they just get dropped ๐Ÿ’…

CUE files containing data tracks which specify a starting time greater than zero cannot be converted by cue2toc, because the TOC format does not provide a way to specify a starting time at all for data tracks. like, at all. however โ€” if the CUE file does not contain any audio tracks you can try to use the CUE file directly with cdrdao. so there's a little loophole ๐ŸŒˆ


๐Ÿ“ EXAMPLE ๐Ÿ“

suppose we have the following CUE file "uwe.froehn.cue" describing an audio CD with CD-Text data:

REM Example CUE file with audio tracks
CATALOG 1234567890123
TITLE "Der Berg ruft"
PERFORMER "Uwe Froehn"
FILE "uwe.froehn.mp3" MP3

TRACK 01 AUDIO
  TITLE "Meine Mama ist die Beste"
  PERFORMER "Uwe Froehn"
  SONGWRITER "Hansi Klabuster"
  REM two seconds pregap filled with audio data
  INDEX 00 00:00:00
  INDEX 01 00:02:00
  REM subindexes
  INDEX 02 00:35:17
  INDEX 03 01:12:44

TRACK 02 AUDIO
  TITLE "Hoch oben im Tal"
  SONGWRITER "Gabi Geil"
  REM no pregap
  INDEX 01 02:45:38

TRACK 03 AUDIO
  REM pregap with zero data
  PREGAP 00:4:47
  INDEX 01 07:58:74
  REM postgap with zero data
  POSTGAP 00:35:00

since cdrdao cannot decode the MP3 file on the fly, this step must be carried out by hand, e.g. using lame:

lame --decode uwe.froehn.mp3 uwe.froehn.wav

although the filename appears only once in the example CUE file, it gets written for every track in the TOC file โ€” so you would need to edit lots of occurrences of the filename in the TOC file by hand ๐Ÿ˜ญ. for this reason you can specify a string with the -w option to be used by cue2toc as the filename for all audio tracks. the command

cue2toc -w uwe.froehn.wav -o uwe.froehn.toc uwe.froehn.cue

should produce the file uwe.froehn.toc with the following content:

CATALOG "1234567890123"
CD_DA
CD_TEXT {
    LANGUAGE_MAP {
        0 : EN
    }
    LANGUAGE 0 {
        TITLE "Der Berg ruft"
        PERFORMER "Uwe Froehn"
    }
}

TRACK AUDIO
    CD_TEXT {
        LANGUAGE 0 {
            TITLE "Meine Mama ist die Beste"
            PERFORMER "Uwe Froehn"
            SONGWRITER "Hansi Klabuster"
        }
    }
    AUDIOFILE "uwe.froehn.wav" 00:00:00 02:45:38
    START 00:02:00
    INDEX 00:35:17
    INDEX 01:12:44

TRACK AUDIO
    CD_TEXT {
        LANGUAGE 0 {
            TITLE "Hoch oben im Tal"
            SONGWRITER "Gabi Geil"
        }
    }
    AUDIOFILE "uwe.froehn.wav" 02:45:38 05:13:36

TRACK AUDIO
    PREGAP 00:04:47
    AUDIOFILE "uwe.froehn.wav" 07:58:74
    SILENCE 00:35:00

slay, look at that output โœจ


๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

cdrdao(1), lame(1)


๐Ÿ’€ BUGS ๐Ÿ’€

since cue2toc's definition of the CUE format is entirely based on a number of different CUE files the author came across, there is a very high probability that it will not work correctly with all the other CUE files you might encounter ๐Ÿซ . if this is the case for you, please send the problematic CUE file along with the version number of cue2toc to <dermatsch@gmx.de>. she wants your bug reports, fr fr ๐Ÿ“ฌ


๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

Matthias Czapla <dermatsch@gmx.de>


and that's the whole page bestie!! this cutie came out of the General Commands Manual, cue2toc(1), section 1 โ€” so go forth, convert those audio CUEs, and remember: keep SONWRITER spelled exactly like that ๐Ÿ’…โœจ๐Ÿฆ‹