An avid PC world reader wrote: "I was particularly intrigued by the fact that after ripping my audio CD to the MP3 format in WinAmp, it would read the song info and fill in the headers." Tim wondered how this worked so ... there are two ways to figure out what is on a CD: fingerprinting and CD text.
The fingerprint of a CD, called the CDDB ID, is an almost unique value -- "almost" because it is possible for two (or more) compact disks to have the same fingerprint. Freedb explains: "The disc ID ... is not as good as it could be -- in fact, it is pretty bad as a unique identifier for a CD. Therefore, completely different CDs (with the same length in seconds and the same [number of tracks]) can have the same disc ID ... This disc ID algorithm and the cddb protocol can unfortunately not be changed without losing backward compatibility to existing applications."
According to Wikipedia, the CDDB ID "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. 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."
Actually that description was for the old CDDB1 service, the free version of the Gracenote database that was shut down in 2001. As far as I can determine the IDs in the "new" Gracenote database are formed using the same algorithm but the old access protocol, also called CDDB1, has been changed by Gracenote and is not backward compatible.
The free services support the CDDB1 ID format and, like Gracenote, support access via an HTTP form (unique to each service), but unlike Gracenote they support the CDDB1 protocol -- Gracenote uses a proprietary version for commercial reasons. Note that Gracenote also keeps the CDDB IDs hidden, while freedb and tracktype both display the ID and allow you to search by it.
Just in case you were asking yourself, "Self, I wonder what the ID is for Led Zeppelin's 'Led Zeppelin III,'" the answer is 7f10d60a.
WinAmp, in common with many other music management applications, figures out the CDDB ID when it reads a CD and then automagically looks it up using whichever CD database you've configured it for. Thus when you rip a CD, WinAmp can fill in the MP3 header tags.
Actually, depending on which service you use, you will occasionally get multiple matches in which users disagree on the details of a CD or, as I pointed out earlier, two or more CDs have the same fingerprint. WinAmp will ask you to choose which you think is the correct version for your CD.