MARK'S AUDIO ARCHIVE : MUSIC LIBRARY

Contact | Wants List | Swapping rules | Artist A-Z | Useful Links | FAQS

Superb Guide to Burning CDs Properly


Mark's Concise Compact Disk Primer
Mark Filipak, 2002, no rights reserved.

Introduction
============
It is helpful to have a rudimentary understanding of the CD technology
presented in sections 1 through 5, but if you merely want to learn how
to use CUE sheets, EAC (Exact Audio Copy), mkwACT (for making SHN files
and extracting audio files from SHN files), and how to avoid some common
pitfalls to get the best results, skip down to section 6.

Stay tuned for future updates.

Comments and corrections always welcome at filipak@mrincubator.org


Contents
========
  1   Introduction to CD Technology
  2   Red Book - CD and CD-DA
  2.1   Blocks - All CD's 1st-Level Data Structure
  2.1.1   Sync Bits
  2.1.2   Block Subcode ID byte
  2.1.3   Payload
  2.1.4   Block error correction
  2.1.5   EFM merge bits
  2.1.6   EFM encoding
  2.2   Table of Contents (TOC) - All CD's 2nd-Level Database Structure
  2.3   Audio Frames - An Audio CD's 2nd-Level Data Structure
  2.4   Audio Samples - An Audio CD's 3rd-Level Data Structure
  3   Yellow Book - CD-ROM and CD-ROM XA
  3.1   Data Sectors - A Data CD's 2nd-Level Data Structure
  3.1.1   Mode 1 CD-ROM Data Sectors
  3.1.1.1   Mode 1 CDR capacities
  3.1.2   Mode 2 CD-ROM XA Data Sectors
  3.1.2.1   Mode 2 CDR capacities
  3.2   Data Directories - A Data CD's 3rd-Level Database Structure
  3.2.1   ISO-9660 Directory Format Family
  3.2.2   ISO-13346 Directory Format Family
  3.2.3   UDF Bridge Format
  3.2.4   Directories
  3.2.5   Root Directory
  4   Orange Book - CD-MO, CD-R, and CD-RW
  5   Blue Book - Enhanced Music CD (aka: CD Extra)
  6   Cue Sheets - Learning By Example
  6.1   Step 1 - The Whole Cue Sheet
  6.2   Step 2 - What the Lines Mean
  6.2.1   Header Information
  6.2.2   File Directive
  6.2.3   Track Directive
  6.2.3.1   About Time
  6.2.4   Cue Sheet Odds and Ends
  6.2.4.1   Count Down
  6.2.4.2   Silence Gaps Between Tracks
  6.2.4.3   Remarks
  6.3   Step 3 - Conceptual Overview
  6.3.1   Inputs
  6.3.2   Outputs
  6.3.3   Linking Inputs and Outputs
  7   Installing and Setting Up EAC
  8   Ripping With EAC
  8.1   Ripping Entire Discs
  8.1.1   Errors When Ripping Entire Discs
  8.1.2   Cue Sheet Generation
  8.1.3   Moving Index Points
  8.2   Accurate Track Ripping
  8.2.1   Secure Mode
  8.2.2   Test & Copy Selected Tracks
  8.3   Ripping Problem Tracks
  8.3.1   Paranoid Mode
  8.3.2   Copy Selected Tracks
  8.4   Fixing Bad Samples
  8.5   Making a Cue Sheet
  9   Burning With EAC
  9.1   Burning With a Cue Sheet
  9.2   Burning Without a Cue Sheet
  10   SHN files
  11   Avoiding Common Pitfalls
  11.1   SHN Unverified Extraction Quirk
  11.2   Easy CD Creator Multiple Copy Quirk


1   Introduction to CD Technology
=================================
The material presented here is a combination of knowledge gained from
a great number of sources plus my 24 years of experience as a digital
design engineer. An excellent web site to begin further study is:

  http://www.discusa.com/cdref

Buried in the 'far' side of the plastic that constitutes a compact
disc's under surface there is a spiral 'groove' that consists of a
series of up and down (or in the case of a CD-ROM, reflective and non
reflective) alternations that are termed "pits" and "lands". As the disc
spins, the disc reader shines a beam of laser light up and onto the
'groove'. A laser detector catches the laser light's reflection which is
either a sharp, bright dot of light or a wide, dull circle of light
depending upon whether the reflecting surface is in focus or out of
focus. The disc reader attempts to always keep the reflection returned
from the top of the lands in focus. Thus, the laser's reflection is
modulated by the passing pits. The detector 'sees' the modulations as a
blinking light and converts it into an electrical signal that the
downstream electronics interprets as a digital bit stream.

The bits in the bit stream are aggregated into 588 bit blocks that can
hold either audio or data payloads. Blocks in turn are aggregated into
either 98 block audio frames or 98 block data sectors. The format of
blocks and audio frames are defined in the Red Book, as is the compact
disc digital audio (CD-DA) standard. The format of data sectors is
defined in a supplementary volume: the Yellow Book, and further refined
in the Orange Book.

Multimedia CDs use a combination of audio, video, and data. There have
been many attempts to integrate the various interpretations of the
underlying blocks in a compatible manner, but it wasn't until the
creation of multisession CDs that this became reliable. The Blue Book
specifies the format of enhanced music CDs that make use of the
multisession CD standard.

The following is a conceptual hierarchy of these and related standards:

  Red Book - CD and CD-DA
    Yellow Book - CD-ROM and CD-ROM XA
      Orange Book - CD-MO, CD-R, and CD-RW
    Multisession CD Book
      Blue Book - Enhanced Music CD (aka: CD Extra)
    Green Book - CD-interactive (CD-i)
      Photo CD Book - CD-interactive Bridge
    White Book - Karaoke CD, VCD, SVCD, and Internet extensions


2   Red Book - CD and CD-DA
===========================
2.1   Blocks - All CD's 1st-Level Data Structure
------------------------------------------------
Each block contains 588 bits, of which 336 bits is called the payload.

                    sync:                          24 bits
        block subcode ID:  1 byte  EFM encoded to  14 bits
                 payload: 24 bytes EFM encoded to 336 bits
  block error correction:  8 bytes EFM encoded to 112 bits
          EFM merge bits:                         102 bits
                                                  ========
                                                  588 bits

  2.1.1   Sync Bits
  -----------------
  The sync bits present a special, unique pattern that the block
  processor can recognize and synchronize to -- the unique sync bit
  pattern marks the beginning of each block. The synchonization is done
  by hardware is of utmost importance. If there is a bit error in those
  24 bits, the CD is either unplayable from that point onwards, or it
  may get stuck there, or it may jump to a completely different part of
  the disc -- the sync bits are the Achilles' heal of CD technology. A
  sync error is not correctable, but very sophisticated rippers like EAC
  can work around such an error and still rip the CD successfully.

  2.1.2   Block Subcode ID byte
  -----------------------------
  The subcode byte identifies whether the block is part of the main
  channel or one of eight sub-channels.

    00000000 - the block is part of the main channel
    00000001 - the block is part of the P channel
    00000010 - the block is part of the Q channel
    00000100 - the block is part of the R channel
    00001000 - the block is part of the S channel
    00010000 - the block is part of the T channel
    00100000 - the block is part of the U channel
    01000000 - the block is part of the V channel
    10000000 - the block is part of the W channel

  Channels P and Q are used as side information to identify tracks,
  program, and timing information. Channels R through W were reserved in
  anticipation of graphics, lyrics, etc.

  2.1.3   Payload
  ---------------
  At the block level there is no inherent difference between audio,
  video, and data payloads. To the block processor the payload is merely
  raw digital data.

  2.1.4   Block error correction
  ------------------------------
  The block processor uses the block error correction bits to provide
  rudimentary error detection and correction. Contrary to conventional
  thought, the error correction is not applied to merely the payload
  bits, but to the block subcode also (and maybe the merge bits as well
  -- I don't know for sure).

  2.1.5   EFM merge bits
  ----------------------
  I'm not really sure what function these bits serve but I think they
  pad out the block with a pattern that 'quiets' the sync detection
  hardware in preparation for the upcoming sync pattern that marks the
  beginning of the next block. If I am right about that, then a serious
  bit error in this part is also a sync error and will also make the
  disc unplayable.

  2.1.6   EFM encoding
  --------------------
  "EFM" means "eight to fourteen modulation". Fourteen bits are used to
  encode each eight bits of information. This simplifies the design of
  the laser optics and the electronics in two ways: 1) it produces pits
  and lands that have known minimum and maximum lengths, and 2) it
  avoids patterns in the data that the block processor might interpret
  as a sync pattern.

The important concept to understand is this: The block described above
is the basis of all 'higher' CD structures that follow in this article.
In other words, all 'higher' structures are built from the payloads
carried within these blocks. This concept is very similar to the way
that a single Internet communication (an e-mail message for example) is
embedded within, and 'carried by' several IP datagrams (several e-mail
packets for example). The idea of collecting many data payloads that are
embedded inside blocks and using the payloads to then build 'higher
level' data structures is the fundamental idea behind the protocol
method of communication. That the underlaying 'carrier' structure (the
block in this case) is basically unrelated to the nature of the 'higher
level' structure (CD audio in this case) may seem strange at first but
it should not be mysterious and it certainly is not unfathomable,

2.2   Table of Contents (TOC) - All CD's 2nd-Level Database Structure
---------------------------------------------------------------------
A CD's table of contents is a fixed format database with exactly 100
track entries. The TOC is assembled from Q channel block payloads and is
physically located in the CD's lead-in area. Each entry in the TOC
contains the address of its associated track in the CD's program area.
The TOC must contain at least a 1st entry, specifying the location of
track 1, and a 100th entry, specifying the location of the lead-out
area. Unused entries are left as zeros.

  The address format is: mm:ss:ff
  where "mm" specifies the number of minutes into the program area,
        "ss" specifies the number of seconds, and
        "ff" specifies the number of frames,
  such that
                       ((mm x 60) + ss) x 75 + ff

  calculates the absolute frame number from the beginning of the program
  area to the first frame of the associated track. The table is
  referenced implicitly, that is, the first entry in the table points to
  the first track, the second entry points to the second track, etc.

Note that to allow for variations between CD players, the first track
must not start at 00:00:00. The Red Book specifies that the first track
can start at 00:02:00, or anywhere thereafter. See "Cue Sheets" further
down in this discussion.

2.3   Audio Frames - An Audio CD's 2nd-Level Data Structure
-----------------------------------------------------------
Each audio frame is assembled from 98 consecutive main channel block
payloads. All audio frames are physically located in the CD's program
area. The audio frame processor provides no additional protection,
relying solely on the underlying block processor's error correction.

    24 audio bytes/block (see Blocks, above)
  x 98 blocks/frame
  ====
  2352 audio bytes/frame

Note that an audio frame is not really a data structure. Rather it is
simply a convenient aggregation of blocks. It actually has no extra
structure. It exists as a quantifiable unit simply because it is the
smallest number of blocks that can be incrementally addressed in the
TOC.

2.4   Audio Samples - An Audio CD's 3rd-Level Data Structure
------------------------------------------------------------
Many audio sampling schemes are possible. The following is the CD-DA
standard.

    2352 audio bytes/frame (see Audio Frames, above)
    x 75 frames/second
  ======
  176400 audio bytes/second

  For 16 bit stereo audio

         176400 audio bytes/second
    ----------------------------------- = 44100 audio samples/second
    2 bytes/sample/channel x 2 channels

  Hence, the familiar 44.1 kHz, compact disc digital audio standard,
  though the whole thing was actually designed the other way around,
  starting from 44.1 kHz and going down to the block level.

  Tip: Each CD-DA frame must be 1/75th of a second, containing exactly
  588 samples. Audio can only be recorded in whole frames. Thus, tracks
  must end exactly on a frame boundary. Otherwise, burning software will
  pad out the rest of the frame with silence. This can produce a 'tick'
  that is between 1/588th of second (if one sample is added to round out
  the last frame in a track) to nearly 1/75th of a second (if 587
  samples are added to round out the last frame in the track).

Note that like audio frames, audio sample format is not really a data
structure either. Rather it is a contextual standard (called: CD-DA)
that the audio playback system assumes. Thus, if you make a CD
containing any audio format other than 16-bit, stereo at 44.1 kHz, it
will play, but only harsh noise will come out of the speakers.

CD-DA is the (technologically) shortest path between CD blocks and your
ears without consideration for random access in the true sense of the
term or scalability (for example, from monuaral to stereo, or from 44.1
kHz to 96 kHz, etc.).


3   Yellow Book - CD-ROM and CD-ROM XA
======================================
The Yellow Book supplements the Red Book and builds on its basic block
structure.

3.1   Data Sectors - A Data CD's 2nd-Level Data Structure
---------------------------------------------------------
Each data sector is assembled from 98 consecutive main channel block
payloads. Like audio frames, each data sector holds 2352 bytes of data,
but unlike audio frames, data sectors have extra structure that
incorporates additional error detection and in most cases, extra error
correction. There are two flavors of data sectors: mode 1 and mode 2.

  3.1.1   Mode 1 CD-ROM Data Sectors
  ----------------------------------
  The 2352 bytes conveyed by the underlying 98 block payloads has the
  following structure:

                       sync:   12 bytes
                  sector ID:    4 bytes
                       data: 2048 bytes
     sector error detection:    4 bytes
                    padding:    8 bytes (zeros)
    sector error correction:  276 bytes
                             ==========
                             2352 bytes/sector

  The mode 1 data sector processor uses the sector error detection and
  correction bytes to detect and correct most errors that could not be
  corrected by the underlying block processor.

    3.1.1.1   Mode 1 CDR capacities
    -------------------------------
    The capacity of CDRs can be calculated as either mega-bytes or
    mm:ss:ff. The program CDR Identifer does both and though it's ATIP
    (Absolute Time In Pre-groove) report may be suspect regarding die
    strategy and other information, the capacity information must be
    correct as it is part of the physical 'groove' information present
    in the glass master from which the CDRs are made and though a
    manufacturer may change dye strategy without changing the master, it
    cannot change the 'groove' dimensions, pitch, or run length.

    Mode 1 data sizes for nominal CDR capacities are:

      mm:ss =        capacity if used for data
      -----   -----------------------------------------
      74:00 = 681,984,000 bytes = 666,000 kB = 650.4 MB
      80:00 = 737,280,000 bytes = 720,000 kB = 703.2 MB

  3.1.2   Mode 2 CD-ROM XA Data Sectors
  -------------------------------------
  Mode 2 increases data capacity by dropping the extra level of error
  correction afforded by mode 1 and reusing those 276 bytes for data. As
  a consequence, mode 2 relies solely on the underlying block processing
  for error correction. Since mode 2 provides no extra error correction
  it is used solely for audio and video sectors on multimedia CD-ROMs.

                       sync:   12 bytes
                  sector ID:    4 bytes
                       data: 2324 bytes
     sector error detection:    4 bytes
                    padding:    8 bytes (null)
                             ==========
                             2352 bytes/sector

  The mode 2 data sector processor could use the four error detection
  bytes to detect some additional errors that could not be corrected by
  the underlying block processor, but it cannot correct them. Whether
  all mode 2 data sector processors in all CD-ROM XA compatible players
  in fact actually provide this extra error detection is unknown. Since
  the processor cannot do anything to fix detected errors I suspect that
  most simply ignore the four bytes and do no extra error checking at
  all.

    3.1.2.1   Mode 2 CDR capacities
    -------------------------------
    Mode 2 data sizes for nominal CDR capacities are:

      mm:ss =        capacity if used for data
      -----   -----------------------------------------
      74:00 = 773,892,000 bytes = 755,753 kB = 738.0 MB
      80:00 = 836,640,000 bytes = 817,031 kB = 797.8 MB


3.2   Data Directories - A Data CD's 3rd-Level Database Structure
-----------------------------------------------------------------
Once they have been read from a CD the data sectors described above are
not directly accessable by a computer's operating system (and thereby,
by the user) without yet a 'higher level' of structure. This 3rd-level
structure is a database termed: "a directory system".

There are many types of directory systems in use today. Some of them are
fairly primitive and support fixed file naming (the infamous 8.3 naming
convention for example), while others support long file names with and
without allowing embedded spaces within the file names and utilizing
differing styles of subdirectory referencing (for example: '/' versus
'\'). Each directory structure has its strengths and weaknesses. What
they all have in common is that they are all linear databases. That is,
they all have hierarchical structures that prohibit random access.
(Note: to my knowledge the only operating system that supports random
access is the Pick operating system and it is not used for CDs, or for
much else.)

Examples of CD directory formats are:

  3.2.1   ISO-9660 Directory Format Family
  ----------------------------------------
  These file systems include basic ISO-9660, Joliet (Microsoft extension
  to ISO-9660), and Macintosh HFS (Apple extension to ISO-9660). If you
  shun Joliet and Macintosh HFS and stick with basic ISO-9660 and follow
  the ISO-9660 rules regarding naming and use only the US-ASCII upper
  case characters plus underline, then in theory anyone will be able to
  access the disc no matter what operating system their computer uses.
  Of course, this means using ALL CAPS, one to eight character names
  optionally followed by a single dot and by zero to three character
  name extensions. Such restrictions limit your file names to the
  following languages: Latin, Swahili, Hawaiian, and American English.

  3.2.2   ISO-13346 Directory Format Family
  -----------------------------------------
  These file systems include UDF (Universal Disk Format) and M-UDF
  (micro-UDF, a UDF subset for use in DVDs).

  3.2.3   UDF Bridge Format
  -------------------------
  This is a file system based on both ISO-9660 and M-UDF that is
  intended to provide a compatible bridge between ISO-9660 and ISO-13346
  (i.e., between PCs, Macintoshes, Linux, etc.) -- the holy grail of
  file systems.

A full discussion of these file systems is beyond the scope of an
introductory text such as this.

  3.2.4   Directories
  -------------------
  Directories are what you see as folders in Windows Explorer or in the
  Macintosh Finder. They are database fragments that have a hierarchical
  superstructure. That is, in aggregate directories conform to a serial
  access system that is defined by the computer's operating system.

  A hierarchical structure means that there is a top folder (i.e., the
  root directory -- explained below) that can contain either data files
  or pointers to lower level folders (i.e., subdirectories -- also
  explained below) which in turn can contain either data files or
  pointers to even lower level folders (i.e., subdirectories of
  subdirectories, etc.).

  In general, directory entires point to either files or to lower level
  directories (i.e., subdirectories). The pointers are in the context of
  how the mass storage medium is accessed, usually by cylinder-head-
  sector in old hard disk systems or by logical block in new hard disk
  systems or by i-node in abstract file systems such as are encountered
  in Linux or other UNIX-based computers.

  3.2.5   Root Directory
  ----------------------
  If a data CD's data sectors can hold either data or directories, how
  does an operating system differentiate between the two? In other
  words, how can your computer tell data from database? The key is this:
  The first data sector encountered on a CD that contains data sectors
  must be a directory. In fact, it must be a special directory termed:
  "the root directory".

The important concepts to understand are these: 1, A computer can only
access the data on a data CD if it understands the directory structure
used on that CD, and 2, audio CDs contain no such 3rd-level directory
structure and so, audio 'data' is only accessable as a serial bit
stream. This second fact is directly related to how well a CD audio
ripper is at doing its job. Superficially, cue sheets may look like the
equivalent 3rd-level of structure for audio CD's but they are not. As
outlined in a later section, cue sheets are merely recipes for
constructing an audio CD's TOC, i.e., its 2nd-level database structure.


4   Orange Book - CD-MO, CD-R, and CD-RW
========================================
(to be completed)


5   Blue Book - Enhanced Music CD (aka: CD Extra)
=================================================
(to be completed)


6   Cue Sheets - Learning By Example
====================================
Cue sheets can be confusing. Here's a pretty complex example from "3
Tier Dream" disc 2, a bootleg of Tangerine Dream's London 81 concert.
What I will do is: step 1, hit you with the whole thing, then, step 2,
break it apart and explain the parts, then, step 3, give you a
conceptual overview so that you can write cue sheets in your sleep
without needing examples -- hopefully this approach will impart in-depth
knowledge.

6.1   Step 1 - The Whole Cue Sheet
----------------------------------
  PERFORMER "Tangerine Dream"
  TITLE "London 1981"
  FILE "Tadream_1981-10-20_01_.wav" WAVE
    TRACK 01 AUDIO
      TITLE "Logos "
      PREGAP 00:02:00
      INDEX 01 00:00:00
      REM running time = 10:17
    TRACK 02 AUDIO
      TITLE "Sobornost/Edinburgh Castle"
      INDEX 01 10:17:45
      REM running time = 8:54
    TRACK 03 AUDIO
      TITLE "<8105 - Mournful March>"
      INDEX 01 19:11:18
      REM running time = 2:40
    TRACK 04 AUDIO
      TITLE "<8106 - 3 Part Rondo>"
      INDEX 01 21:51:00
      REM running time = 5:05
    TRACK 05 AUDIO
      TITLE "<8107 - Brass March>"
      INDEX 01 26:56:11
      REM running time = 7:07
    TRACK 06 AUDIO
      TITLE "Bondy Parade"
      INDEX 01 34:03:73
      REM running time = 12:43
  FILE "Tadream_1981-10-20_02_.wav" WAVE
      REM  Append the first part of the second wave file
      REM  to track 6.
      INDEX 02 00:00:00
    TRACK 07 AUDIO
      TITLE "Calymba Caly "
      INDEX 01 00:57:70
      REM running time = 3:57
    TRACK 08 AUDIO
      TITLE "<8102b - Percussion Bridge>"
      INDEX 01 04:54:49
      REM running time = 2:06
    TRACK 09 AUDIO
      TITLE "<8102c - Bourrée>"
      INDEX 01 07:00:28
      REM running time = 5:40
    TRACK 10 AUDIO
      TITLE "Remote Viewing (intro)"
      INDEX 01 12:40:74
      REM running time = 1:14
    TRACK 11 AUDIO
      TITLE "Force Majeure "
      INDEX 01 13:54:25
      REM running time = 2:01
    TRACK 12 AUDIO
      TITLE "Force Majeure "
      INDEX 01 15:55:30
      REM running time = 1:49
    TRACK 13 AUDIO
      TITLE "Logos "
      INDEX 01 17:44:32
      REM running time = 2:30
  FILE "4_seconds_of_silence_.wav" WAVE
    TRACK 14 AUDIO
      TITLE "Kiew Mission (missing)"
      INDEX 01 00:00:00
  FILE "4_seconds_of_silence_.wav" WAVE
    TRACK 15 AUDIO
      TITLE "Choronzon (missing)"
      INDEX 01 00:00:00

6.2   Step 2 - What the Lines Mean
----------------------------------
Each line must have keywords, preferably in ALL CAPS, to identify its
intended function.

  6.2.1   Header Information
  --------------------------
  These two should be pretty self explanatory

    PERFORMER "Tangerine Dream"
    TITLE "London 1981"

  6.2.2   File Directive
  ----------------------
  In a file directive, the key words are "FILE" and "WAVE"

    FILE "Tadream_1981-10-20_01_.wav" WAVE

  Note how the name of the '.wav' file is quoted between the two
  keywords. This is the input file for everything that follows until a
  new input file is declared. For CD-DA, the first file declared must
  convey audio. Two other types of audio are possible in addition to
  WAVE. They are AIFF and MP3.

  For CD-DA, all audio files must be 44.1 kHz, 16-bit stereo.

  6.2.3   Track Directive
  -----------------------
      TRACK 01 AUDIO
        TITLE "Logos "
        PREGAP 00:02:00
        INDEX 01 00:00:00
        REM running time = 10:17

    First, this...

    6.2.3.1   About Time
    --------------------
    Time is declared with the format: 'mm:ss:ff',
    where 'mm' is two digits of minutes (i.e., 00 to 99),
          'ss' is two digits of seconds (i.e., 00 to 59), and
          'ff' is two digits of frame number (i.e., 00 to 74).

    In most cases, 'mm:ss:ff' is an elapsed time marker from the
    beginning of the input audio file. The exceptions: PREGAP and
    POSTGAP (covered later in this article), are durations. Whenever a
    new input file is declared, time restarts at 00:00:00.

    Note that, though time markers have the same form as addresses in a
    CD's TOC (i.e., mm:ss:ff), they are not related.

  So, what does the track directive above say?
  Line 1: It declares that it is TRACK 01 and that it is AUDIO.
          Fact: The Red Book specification allows the first track of a
          disc to be any track number, so for example if the last track
          of a two disc set is TRACK 12, then the first track of the
          second disc can be TRACK 13 -- but be sure to read the next
          fact.
          Fact: If the 1st track of a disc is anything other than TRACK
          01, many CD players will refuse to play it!
          Fact: For CD-DA, the 1st track must be AUDIO.
          Fact: For CD-DA, no track may be shorter than 4 seconds.
  Line 2: Since this follows a "TRACK" directive it is the track title
          rather than the album title.
  Line 3: The "PREGAP" directive adds silence.
          Fact: For CD-DA, a 1st track PREGAP of at least 2 seconds is
          mandatory. Pregaps for other tracks are not required, but can
          be declared to add silence.
  Line 4: At least one index, INDEX 01, must be declared in each track.
          Fact: Most CD players don't display indexes.
  Line 5: This is a remark. Remarks will be covered further along in
          this primer.

      TRACK 02 AUDIO
        TITLE "Sobornost/Edinburgh Castle"
        INDEX 01 10:17:45

  This declares TRACK 02, INDEX 01, beginning at elapsed time =
  10:17:47. This is not declaring TRACK 02's length, but it's starting
  elapsed time offset in the input file. Note that since TRACK 01,
  started at 00:00:00, the time 10:17:47 is really the length of TRACK
  01, though track lengths are never explicitly declared.

      TRACK 03 AUDIO
        TITLE "<8105 - Mournful March>"
        INDEX 01 19:11:18

  Okay, this declares -- all together now -- TRACK 03, INDEX 01,
  beginning at the elapsed time: 19:11:18.

  Now, take a look at this:

    FILE "Tadream_1981-10-20_02_.wav" WAVE
        INDEX 02 00:00:00
      TRACK 07 AUDIO
        TITLE "Calymba Caly "
        INDEX 01 00:57:70

  Holy mackerel, eh? Okay, let's analyze it:
  Line 1: This declares a new input file.
  Line 2: As required, elapsed time restarts at 00:00:00, but where's
          the TRACK directive, right?
  Line 3: There's the TRACK directive.
  Line 5: And it begins with INDEX 01, as it must, but look at the
          elased time! 00:57:70. This is saying to start TRACK 07, INDEX
          01, at a point that is 57 seconds + 70 frames into the file
          Tadream_1981-10-20_London_02_.wav.

  What happens is that the audio from 00:00:00 to 00:57:69 of the new
  file will be appended to the previous track as INDEX 02! This is how
  you stitch parts of two different files together in the same track!

  Pretty cool, eh?

  The CD player will show "6" as the track number throughout "Bondy
  Parade", through the fadeout, through the fadein, and through the 57
  minute bridge, and will flip to "7" exactly on the first note of
  "Calymba Caly ".

  One last point about tracks: PERFORMER directives can also be used
  within tracks. That way, 'various artists' discs can be accommodated
  with each track having a different performer.

  6.2.4   Cue Sheet Odds and Ends
  -------------------------------
    6.2.4.1   Count Down
    --------------------
    Have you ever noticed that for some tracks of some CDs the time
    display indicates a count down? Count downs are the domain of the
    INDEX 00 directive. For example, you can specify a four second count
    down like this:

        TRACK 02 AUDIO
          INDEX 00 10:17:47
          INDEX 01 10:21:47

    Note that the track number still changes at 10:17:47, but instead of
    counting up from "00:00" a CD player will instead count down:
    "-00:03", "-00:02", "-00:01", "00:00" before counting up. Of course,
    at the end of track 2, the cumulative time as read on a CD player
    just prior to the start of track 3 will be 4 seconds less than it
    would otherwise have been.

    6.2.4.2   Silence Gaps Between Tracks
    -------------------------------------
    To add a silence gap at the end of a track, use the POSTGAP command.
    For example,

        TRACK 02 AUDIO
          INDEX 01 10:17:47
          POSTGAP 00:01:00
        TRACK 03 AUDIO
          INDEX 01 19:11:18

    adds one second of silence at the end of TRACK 02. Note that since
    the INDEX times are relative to the input file, they do not change,
    (thus, TRACK 03 still starts at 19:11:18), however, the running time
    of track 2 as read on a CD player will be one second longer. If
    used, POSTGAP must be the last directive for the track.

    6.2.4.3   Remarks
    -----------------
    Using REM, you can insert remarks into the cue list at any point.
    For example,

      FILE "Tadream_1981-10-20_02_.wav" WAVE
          REM  Append the first part of the second wave file
          REM  to track 6.
          INDEX 02 00:00:00
        TRACK 07 AUDIO
          TITLE "Calymba Caly "
          INDEX 01 00:57:70
          REM running time = 3:57


6.3   Step 3 - Conceptual Overview
----------------------------------
From a conceptual perspective, what we have going on in the cue sheet is
two things at once. The first thing has to do with inputs, and the
second thing has to do with outputs.

  6.3.1   Inputs
  --------------
    FILE "Tadream_1981-10-20_London_01_.wav" WAVE
    FILE "Tadream_1981-10-20_London_02_.wav" WAVE
    FILE "4_seconds_of_silence_.wav" WAVE

  The input files are loaded one after the other with no gap -- be sure
  you set your burning program so that it doesn't add a gap. If you want
  a gap at the end of any particular tracks, include a POSTGAP directive
  at the end of those tracks that are to end with a gap.

  6.3.2   Outputs
  ---------------
      TRACK 01 AUDIO
        PREGAP 00:02:00
        INDEX 01 00:00:00
      TRACK 02 AUDIO
        INDEX 01 10:17:45
      TRACK 03 AUDIO
        INDEX 01 19:11:18
      TRACK 04 AUDIO
        INDEX 01 21:51:00
      TRACK 05 AUDIO
        INDEX 01 26:56:11
      TRACK 06 AUDIO
        INDEX 01 34:03:73
        INDEX 02 00:00:00
      TRACK 07 AUDIO
        INDEX 01 00:57:70
      TRACK 08 AUDIO
        INDEX 01 04:54:49
      TRACK 09 AUDIO
        INDEX 01 07:00:28
      TRACK 10 AUDIO
        INDEX 01 12:40:74
      TRACK 11 AUDIO
        INDEX 01 13:54:25
      TRACK 12 AUDIO
        INDEX 01 15:55:30
      TRACK 13 AUDIO
        INDEX 01 17:44:32
      TRACK 14 AUDIO
        INDEX 01 00:00:00
      TRACK 15 AUDIO
        INDEX 01 00:00:00

  Fifteen tracks. Each track with at least one index. And there's a two
  second pregap before INDEX 01 of TRACK 01.

  Note the index times. In TRACK 06, between INDEX 01 and INDEX 02, we
  switch files, so times restart at 00:00:00 at that point.

  6.3.3   Linking Inputs and Outputs
  ----------------------------------
  The linkage between inputs and outputs are: 1) the interleaving of
  input and output directives in the cue sheet, together with 2) the
  fact that all INDEX times reference cue points within the previously
  declared file. Even if there is only one file these file cue point
  times will not correspond to the times displayed by a CD player if any
  track contains a POSTGAP directive. Just remember that the times are
  relative to the input wave file, not to the output playback.

Now, go back to 6.1 and look at the whole cue sheet again. I trust that
it will make perfect sense. Just don't forget to put PREGAP 00:02:00 in
TRACK 01 immediately before INDEX 01. That's the easiest thing to forget
and leaving it out will cause the disc to be non-Red Book (...Poof! It
may not play!).


7   Installing and Setting Up EAC
=================================
EAC (Exact Audio Copy) is the only tool I use to rip and burn CDRs. Once
installed and properly set up it is utterly fantastic, but setting it up
can be very difficult and the steps can be confusing. Hopefully, this
tutorial will help you get past the worst bumps.

(to be completed)


8   Ripping With EAC
====================
Be prepared to be amazed by EAC. I have some 'unofficial' concert CDs
that appeared to have occasional noise in one or both channels when
listened to using several top-of-line CD players. I assumed that the
noise was in the audio -- probably caused by drop outs on the tape from
which the CD was made -- but after ripping with EAC I happily discovered
that the noise was not in the resulting '.wav' file! The noise was
actually uncorrectable playback errors that none of the CD players could
fix, but that somehow, EAC could!

EAC contains several useful, high precision features that make it a joy
to use. The ones I find most useful are:

  Test & Copy Selected Tracks function,
  Copy Selected Tracks function,
  Secure Mode,
  Paranoid Mode,
  Compare WAVs tool,
  Detect Gaps function,
  Create CUE Sheet function, and
  IMG wizard.

8.1   Ripping Entire Discs
--------------------------
This is the most useful method of ripping a disc, especially if the
music is continuous from track to track. This method automatically
creates a single '.wav' file and a basic cue sheet. The '.wav' file
contains the audio for the entire disc and the cue sheet is the recipe
for breaking this file into tracks when you burn. Note that dividing the
tracks into individual files is often not only unnecessary but
undesirable.

  Prerequisites are:
    EAC's Secure Mode, and
    EAC's IMG ripping wizard.

If they are in good shape most discs can be ripped in one step to
produce a single '.wav' file. There are two reasons why this is the best
approach.

  1, It is usually easier to edit a single '.wav' file, especially if
     you want to preserve the relative volume levels between tracks.
  2, Moving a track index point is trivial if the entire disc is ripped
     as a single file. Otherwise, moving an index will require cutting
     and pasting between '.wav' files and that is just an opportunity to
     make mistakes.

To do the rip, ignore the tracks listed in the window and click the IMG
wizard icon instead. This will open the "Save Waveform" dialog. Give the
incipient '.wav' file a name and click 'Save".

When the rip is finished you are presented with a "Status and Error
Messages" window.

  Tip: I recommend writing down the CRC (cyclic redundancy check) code
  and performing a second, confirmation rip -- be sure to give the
  second rip a different name -- to see if you get the same CRC. If you
  get the same CRC, then there were no errors. If you get a different
  CRC, then one or both of the rips has errors, even if EAC indicates
  that no errors occured -- the reason this might happen has to do, not
  with EAC, but with how your CD reader reports errors.

  8.1.1   Errors When Ripping Entire Discs
  ----------------------------------------
  If there were errors, clicking on the error in the "Status and Error
  Messages" window will bring up the error statistics. Depending upon
  the severity of the error you may choose to rip the tracks
  individually instead of ripping the entire disc. Alternatively, you
  may simply view the trouble spots in both rips using your wave editor
  to see what the differences are. The differences will usually be so
  minor that they don't produce visible differences when viewed in the
  wave editor -- there may be only a few samples that are off by only a
  few values (i.e., by 1 to 10 levels out of +/-32768 levels -- not an
  audible difference).

  EAC reports the file offset of each trouble spot in the "Status and
  Error Messages" window using the format: mm:ss.ttt (i.e.,
  minutes:seconds.thousanths). If you made two rips, you can also use
  EAC's Compare WAVs tool to get the trouble spot offsets. Use the
  offsets to locate the trouble spots in your wave editor and compare
  the two WAVs in those regions to determine whether the errors are
  serious enough to warrant a rerip or ripping by tracks.

    Tip: If you zoom in on the trouble areas to such an extent that the
    single line waveforms are visible (as opposed to the envelope) and
    you don't readily see any differences, then you will not hear those
    tiny differences either, so forget them and pick either '.wav' file
    for further editing.

  8.1.2   Cue Sheet Generation
  ----------------------------

  When ripping an entire disc, EAC automatically creates a basic cue
  sheet. You should view the cue sheet. It may need to be fixed. If the
  disc is not a various artists disc, then extra PERFORMER directives
  can be removed. ISRC directives can also be removed. Especially watch
  out for spurious indexes and for PREGAP directives of less than 2
  seconds, intervals between indexes of less than 2 seconds, and tracks
  with running times of less than 4 seconds -- they all violate Red Book
  standards but I've often seen commercial discs that violate Red Book.
  Often you will need to add the Red Book mandatory PREGAP 00:02:00
  directive to the first track. EAC does not make these mistakes. It
  makes the cue sheet based solely upon what it finds in the disc's TOC.

  8.1.3   Moving Index Points
  ---------------------------
  If, after viewing the disc '.wav' file in a wave editor, you decide to
  move some index points this task is easily done in the cue sheet.
  Simply change the file times associated with the INDEX 01 directives
  to match the index points you determine in your wave editor. Be sure
  to set up your wave editor to reference time in CD frames rather than
  in thousanths of a second.

If you successfully rip the disc and once you have a proper cue sheet
your task is finished and the remainder of this section can be skipped.

8.2   Accurate Track Ripping
----------------------------
There are two reasons why you may want to rip individual tracks.

  1, The music is not continuous between tracks and you want to
     rearrange the tracks to make a new track order.
  2, Ripping the entire disc encountered so many severe errors that EAC
     either couldn't finish the rip or it would have taken many hours,
     you know that only one or two tracks are bad, and you suspect that
     the bad tracks are slowing down the process of ripping the good
     tracks too.

  Prerequisites are:
    EAC's Secure Mode, and
    EAC's Test & Copy Selected Tracks function.

  8.2.1   Secure Mode
  -------------------
  EAC keeps individual settings for each CD reader and each CD burner
  that you have. You can select the CD drive in EAC's main window from
  the drop down list, and then set the options for that drive either
  through the menu system or by right clicking and selecting Options >
  Drive options. Doing so opens the "Options for drive ..." dialog.
  Notice that under the Extraction Method tab there are four methods:
  Secure mode, Paranoid mode, Fast mode, and Burst mode.

  Don't ever use either Fast mode or Burst mode as neither can guarantee
  best accuracy. Always use Secure mode when you can and Paranoid mode
  when Secure mode produces too many errors.

  Note that Extraction Method is a modal (aka: 'sticky') control -- once
  set, the extraction method stays set until you change it.

  Click the radio button that selects Secure mode and "OK" the dialog.

Select the tracks you want to rip. You can select all of them or just a
few. The tracks selected can be all in one group, or you can have
several groups separated by unselected tracks (which will be skipped).

  8.2.2   Test & Copy Selected Tracks
  -----------------------------------
  Once you have the desired tracks selected, rip them using EAC's Test &
  Copy Selected Tracks function. You can reach this function either
  through the menu or by right clicking. The Test & Copy Selected Tracks
  function tells EAC to read each selected track twice. EAC generates a
  CRC on each pass and automatically compares them to see if any errors
  were made. This comparison is a good idea and is in addition to the
  error correction that EAC does within each pass.

A separate file is created for each selected track. A cue sheet is not
automatically generated.

8.3   Ripping Problem Tracks
----------------------------
If EAC cannot extract a track using Secure mode, or if you cannot get
the two CRCs produced by the Test & Copy Selected Tracks function to
agree even after trying Test & Copy several times, then you have no
choice but to try Paranoid mode. Paranoid mode is very slow and it is
not generally recommended, but I have used it to get perfect rips of
tracks that would not rip using any other ripper.

  Prerequisites are:
    EAC's Paranoid Mode,
    EAC's Copy Selected Tracks function, and
    Patience.

  8.3.1   Paranoid Mode
  ---------------------
  EAC keeps individual settings for each CD reader and each CD burner
  that you have. You can select the CD drive in EAC's main window from
  the drop down list, and then set the options for that drive either
  through the menu system or by right clicking and selecting Options >
  Drive options. Doing so opens the "Options for drive ..." dialog.
  Notice that under the Extraction Method tab there are four methods:
  Secure mode, Paranoid mode, Fast mode, and Burst mode.

  Click the radio button that selects Paranoid mode and "OK" the dialog.

Select a track you want to rip. I don't recommend ripping multiple
tracks when in Paranoid mode as it is a slow painstaking process and
it's too easy to get lost and forget which tracks have been finished and
which tracks are raw.

  8.3.2   Copy Selected Tracks
  ----------------------------
  Once you have the desired track selected, rip it using EAC's Copy
  Selected Tracks function. You can reach this function either through
  the menu or by right clicking. The Copy Selected Tracks function tells
  EAC to read the selected track only once. Note that I do not use the
  twice-reading Test & Copy Selected Tracks function when in Paranoid
  mode. I often must rip the track five or more times before I get
  matching CRCs for two of them. The odds of achieving a CRC match on
  two successive passes is simply too small to justify employing the
  Test & Copy Selected Tracks function, which afterall, doubles the time
  for each rip.

A separate file is created for the selected track each time the Copy
Selected Tracks function is executed. Since EAC will overwrite the
previous rip it is of paramount importance to rename that previous rip
before saving the subsequent rip to your hard disk.

A cue sheet is not automatically generated.

When you have finished ripping all the problem tracks in Paranoid mode
be sure to bring the "Options for drive ..." dialog back up and set
Extraction Method back to Secure mode.

8.4   Fixing Bad Samples
------------------------

  Prerequisites are:
    Several Paranoid Mode rips of each problem track,
    EAC's Compare WAVs tool, and
    A wave editor.

8.5   Making a Cue Sheet
------------------------

  Prerequisites are:
    EAC's Detect Gaps function, and
    EAC's Create CUE Sheet function.


9   Burning With EAC
====================
9.1   Burning With a Cue Sheet
------------------------------
There's not much to explain here. In Windows Explorer simply double-
click the CUE file to launch EAC with the cue sheet loaded and ready to
burn. What, no CUE file? Make one.

  Tip: Before burning, check EAC's "CD Layout Editor" dialog and be sure
  to set the menu choice "Layout" > "Add 2 Second Gap On Append" to off
  (i.e., no check mark). Happily, this setting is modal (aka: 'sticky'),
  so once you have turned it off you should never have to kill that
  check mark again. If you want silence gaps between tracks, put them
  into the cue sheet.

9.2   Burning Without a Cue Sheet
---------------------------------
Okay, so maybe you don't want to take the time to make a cue sheet. You
can use EAC's "CD Layout Editor" dialog to fetch files (from the menu:
Layout > Append Files As New Track), but be aware of these rules:

  1, The files must be fetched in play order.
  2, You must set "Add 2 Second Gap On Append" to on (i.e., check mark)
     before fetching the first file.
  3, You must set "Add 2 Second Gap On Append" to off (i.e., no check
     mark) before fetching the rest of the files unless you want silence
     gaps between tracks.
  4, If you want CD text information on the disc, you must have already
     filled in the "CD Title" and "CD Artist" fields in the main window
     (which unfortunately, is not accessable while you are in the "CD
     Layout Editor" dialog), plus you must fill in the track names. It
     is easier to simply make a cue sheet.


10   SHN files
==============
to be completed


11   Avoiding Common Pitfalls
=============================
11.1   SHN Unverified Extraction Quirk
------------------------------------------
Apparently the SHN compression format does not store information that
can be used to verify that a subsequent extraction was made without
errors. This means that when you extract a '.wav' file from a '.shn'
archive, the extraction tool (mkwACT for example) cannot verify that all
went well and that the '.wav' file was extracted properly. To work
around this unfortunate shortcoming, always make and save an additional
'.md5' file that holds the signature of the '.wav' file that you can use
to verify the '.wav' file after extraction. Here's what I do:

Suppose I want to archive D:\Beatles\I_am_the_Walrus.wav. For
convenience I show the directory structure, thus:

  D:\
  |__ Beatles\
      |__ I_am_the_Walrus.wav

First, I make a '.shn' using the '.wav' file as food.

  D:\
  |__ Beatles\
      |__ I_am_the_Walrus.wav
      |__ noname.md5
      |__ I_am_the_Walrus.shn

Note how a signature file, 'noname.md5', was created automatically. I
rename the signature file to 'I_am_the_Walrus.shn.md5' and then also
create a 'temp' subfolder and move the '.wav' file into it.

  D:\
  |__ Beatles\
      |__ I_am_the_Walrus.shn.md5
      |__ I_am_the_Walrus.shn
      |__ temp\
          |__ I_am_the_Walrus.wav

Then I extract a check copy of 'I_am_the_Walrus.wav' from
'I_am_the_Walrus.shn'

  D:\
  |__ Beatles\
      |__ I_am_the_Walrus.shn.md5
      |__ I_am_the_Walrus.shn
      |__ I_am_the_Walrus.wav
      |__ temp\
          |__ I_am_the_Walrus.wav

and perform a binary comparison of the two '.wav' files. I use a very
fancy file browser named 'Windows Commander' that has a built-in binary
comparsion module, but if you are using the standard Windows Explorer
from Microsoft you will need to perform this comparison in a DOS box using
this command line:

  FC /B  I_am_the_Walrus.wav  temp\I_am_the_Walrus.wav

Once I have confirmed that the '.shn' file does indeed contain the right
stuff I delete the check copy of 'I_am_the_Walrus.wav' retaining the
original that I had moved to the 'temp' folder.

  D:\
  |__ Beatles\
      |__ I_am_the_Walrus.shn.md5
      |__ I_am_the_Walrus.shn
      |__ temp\
          |__ I_am_the_Walrus.wav

I then use mkwACT's 'Generate MD5 Signatures' function to generate a
'.md5' file for the '.wav' file in folder 'temp'. To do this in Windows
Explorer, highlight the 'temp' folder in the left pane, right click, and
choose 'Generate MD5 Signatures'. This handy function generates the MD5
signatures for all files in the highlighted folder.

  D:\
  |__ Beatles\
      |__ I_am_the_Walrus.shn.md5
      |__ I_am_the_Walrus.shn
      |__ temp\
          |__ I_am_the_Walrus.wav
          |__ temp.md5

I then rename 'temp.md5' to 'I_am_the_Walrus.wav.md5', move it up to the main
folder, and delete the 'temp' folder.

  D:\
  |__ Beatles\
      |__ I_am_the_Walrus.shn.md5
      |__ I_am_the_Walrus.shn
      |__ I_am_the_Walrus.wav.md5

These are the three files that I archive, together with any other files
I add such as '.cue' files, track listings, and artwork. When I
subsequently copy the archive I verify 'I_am_the_Walrus.shn' using
'I_am_the_Walrus.shn.md5' and when I subsequently extract
'I_am_the_Walrus.wav' I verify it using 'I_am_the_Walrus.wav.md5'. By
employing this dual system I'm confident that nothing bad can happen to
either the '.shn' file or to the '.wav' file that it contains without
knowing about the error.

11.2   Easy CD Creator Multiple Copy Quirk
------------------------------------------
I have used Easy CD Creator versions 3, 4, and 5 to make copies of data
discs, such as SHN archives. All versions have suffered from the
following quirk: When making multiple copies, even if copy verification
is 'ON', only the last copy is actually verified. Since all but the last
copy are unverified you have no way of knowing whether the intermediate
copies were error free. To work around this quirk, don't make multiple
copies. Instead, make one copy and do it multiple times. That way, ECDC
will verify at the end each copy operation.