DiscID

From ThorxWiki
Jump to: navigation, search

The CDDBp DiscID

The discid used by cddb and freedb is an 4byte field, shown in ascii as an 8character hex string, composed in the following manner:

  • XXYYYYZZ
    • XX is a checksum of the track offsets, as measured in seconds, and mod255'd
    • YYYY is simply the length of the CD, as measured in seconds.
    • ZZ is the number of tracks on the CD.
See FreeDB entry for an idea of how this information can be used.

Things to note

  • Time resolution on a CD is measures in "frames" = 1/75th of a second. Yet this method drops any frames that overflow over an exact second count. (ie, they use seconds=frames/75, and drop any remainder (frames%75))
  • The first track traditionally has only a two second pregap, but can, in theory, be longer and used to hold a "hidden" track. (Songs in the key of X did this, with an almost 10 minute offset). This hidden time I will refer to as "track0"
    • YYYY as mentioned above, is the length of the CD in hex, excluding track0 (ie, the "normal" playing time of the CD)
  • The full CDDBp query string includes trackoffsets, in frames (finally), and also the leadout time (in seconds, boo). ie, the length of the CD.
    • This "length of CD" is in decimal, including the pregap on the first track if it exists, and + 2 seconds.


Example1

Songs in the key of X.

cdparanoia -Q reveals:

Table of contents (audio tracks only):
track        length               begin        copy pre ch
===========================================================
  1.    15362 [03:24.62]    41425 [09:12.25]    no   no  2
  2.    15193 [03:22.43]    56787 [12:37.12]    no   no  2
  3.    20760 [04:36.60]    71980 [15:59.55]    no   no  2
  4.    18365 [04:04.65]    92740 [20:36.40]    no   no  2
  5.    15760 [03:30.10]   111105 [24:41.30]    no   no  2
  6.    27830 [06:11.05]   126865 [28:11.40]    no   no  2
  7.    18765 [04:10.15]   154695 [34:22.45]    no   no  2
  8.    22474 [04:59.49]   173460 [38:32.60]    no   no  2
  9.    16846 [03:44.46]   195934 [43:32.34]    no   no  2
 10.    17305 [03:50.55]   212780 [47:17.05]    no   no  2
 11.     9807 [02:10.57]   230085 [51:07.60]    no   no  2
 12.    28510 [06:20.10]   239892 [53:18.42]    no   no  2
 13.    18953 [04:12.53]   268402 [59:38.52]    no   no  2
 14.    18477 [04:06.27]   287355 [63:51.30]    no   no  2
 15.    17930 [03:59.05]   305832 [67:57.57]    no   no  2
TOTAL  282337 [62:44.37]    (audio only)

CDDPp query string is:

e90eb40f 15 41575 56937 72130 92890 111255 127015 154845 173610 196084 212930 230235 240042 268552 287505 305982 4318

Let's compare:

  • The offsets listed via CDDBp are consistently the track begin times from cdparanoia +150
  • The CD lengths, variously:
    • cdparanoia: 282337 frames = 3764 seconds
    • DiscID: eb4 = 3764 seconds
    • cdparanoia + "track0" = 323762 frames = 4316 seconds
    • CDDBp query: 4318 seconds

So, where did those extra two seconds come from in the CDDBp query?!

Example2

Dark Side of the Moon, XX Anniversary Edition

cdparanoia -Q

  1.    18040 [04:00.40]       32 [00:00.32]    no   no  2
  2.    15973 [03:32.73]    18072 [04:00.72]    no   no  2
  3.    31987 [07:06.37]    34045 [07:33.70]    no   no  2
  4.    21303 [04:44.03]    66032 [14:40.32]    no   no  2
  5.    29400 [06:32.00]    87335 [19:24.35]    no   no  2
  6.    34560 [07:40.60]   116735 [25:56.35]    no   no  2
  7.    15420 [03:25.45]   151295 [33:37.20]    no   no  2
  8.    17290 [03:50.40]   166715 [37:02.65]    no   no  2
  9.     9322 [02:04.22]   184005 [40:53.30]    no   no  2
TOTAL  193295 [42:57.20]    (audio only)

CDDBp query

710a1109 9 182 18222 34195 66182 87485 116885 151445 166865 184155 2579
  • Again, CDDBp query offsets are consistently 150 above the cdparanoia offsets
  • CD lengths
    • cdparanoia: 193295 frames = 2577 seconds
    • DiscID: 0a11 = 2577 seconds
    • cdparanoia + "track0" = 193326 frames = 2577 seconds
    • CDDBp query: 2579 seconds

In a nutshell, if you consider the cdparanoia data to be canonical, then the CDDBp DiscID agrees on the total length. The CDDBp query shows the trackoffsets at +150, and the CDDBp query total length is the total length + the "track0" length (if it exists), +150.

there has to be a better way... and there is, see NCDI

It is intended that NCDI will supercede DiscID.
Personal tools
Namespaces

Variants
Actions
Navigation
meta navigation
More thorx
Tools