CDDB - Example Calculation of A CDDB1 (FreeDB) Disc ID

Example Calculation of A CDDB1 (FreeDB) Disc ID

CDDB1 identifies CDs with a 32-bit number, usually displayed as a hexadecimal number containing 8 digits: XXYYYYZZ. The first two digits (labeled XX) represent a checksum based on the starting times of each track on the CD, mod 255. The next four digits (YYYY) represent the total time of the CD in seconds from the start of the first track to the end of the last track. The last two digits (ZZ) represent the number of tracks on the CD.

For example, suppose a CD contains a single track of duration 3610 seconds.

First we calculate the XX checksum by taking the sum of the track starting times mod 255. Since CDs have a 2-second offset from the start of disc data, XX becomes "02".

Second, the total CD play duration of 3610 seconds in hex is 0e1a, so YYYY becomes "0e1a".

Finally, there is one track on this CD so ZZ becomes "01".

So the full disc ID of the example CD is "020e1a01". Any CD which contains one track with a duration of 3610 seconds starting 2 seconds from the beginning of the CD will have this disc ID. To distinguish between different CDs which happen to have the same disc ID, the CDDB1 database is organized into multiple categories. If there is a conflict with different CD releases possessing the same CDDB1 id, they can be placed in a different category (such as classical, rock, blues, folk or misc).

Sample code for calculating CDDB1 disc IDs in various programming languages is available on the web, such as in Java.

Read more about this topic:  CDDB

Famous quotes containing the words calculation and/or disc:

    Common sense is the measure of the possible; it is composed of experience and prevision; it is calculation appled to life.
    Henri-Frédéric Amiel (1821–1881)

    Perhaps all music, even the newest, is not so much something discovered as something that re-emerges from where it lay buried in the memory, inaudible as a melody cut in a disc of flesh. A composer lets me hear a song that has always been shut up silent within me.
    Jean Genet (1910–1986)