Most CD players sound like junk compared to a good turntable, it's true. They're noisy, fuzzy, and just plain unpleasant.
But that's not because of the quality of compact-disk audio. It's because of the player.
Contrary to popular belief, not all CD players are created equal. Unlike a turntable, which converts vibration in the stylus - through a sort of microphone - into an electrical signal, a CD player instead must deal with a constant input of digital data which must be converted to analog in real-time. Most CD players have three parts: The transport, or pickup; the digital-to-analog converter, or DAC, and the output stage. The transport is a mechanical device containing a motor to spin the disc and a laser to read the CD; the DAC turns the digital signal into audio, and the output stage sets the gain and output impeadance to more usable levels.
The first source of problems is often within the optical pickup on the transport. Each "stripe" of data on a CD is only a fraction of a millimeter wide, and the laser which reflects off of it must be very precisely placed. If the laser pickup is unable to read parts of the CD, that data - and hence, music - is lost.
While a CD player is able to by design able to "smooth over" any missing data, large holes will in turn result in reduced quality. While this is not a problem for most modern CD players, a cheap transport in a cheap CD player (not necessarily an old one) will reduce sound quality.
The most common problem, however, is with the DAC. Digital audio is converted using Nyquist's Sampling Theorem, which essentially states that an analog signal can be turned into data by taking its level on a regular basis. Compact disc audio is 16-bit, and hence has 65,536 possible output levels, which are varied between to create an analog signal. The signal changes level over 44 thousand times per second. Both of these are in excess of what most people can discern - but this is meaningless if not all of it is used.
One of the most common tricks for lowering the price of a DAC is "oversampling". By sampling the frequency twice as fast, it's possible to replicate a voltage at double the actual level of resolution (say, 1.5 volts ) by quickly switching between 1 and 2 volts at double the normal sampling speed. While this can do good things for signal quality for high-quality DACs that oversample at an effective 20 bits (standard 16 bits - but eight times as fast!), many cheap DACs are often just 12-bit DACs set to oversample to an effective 16 bits.
In addition to oversampling, some DACs are simply of low quality. These DACs use poor-quality parts or inferior design, and simply do not sound very good. As a rule of thumb, cheap electronics have poor-quality DACs, while better-quality electronics have better-quality DACs. There are many different varieties, though Texas Instruments makes some of the best.
While even relatively inexpensive transports often are more than adequate, built-in DACs are often of low quality in many CD players. AS a result, many CD players sport external S/PDIF digital audio connections for use with recievers that have on-board DACs, or discrete DAC modules. If you have an older-model CD player, an external DAC may be a valuable upgrade.
Finally, it is hard to ignore the output electronics. Some CD players use cheap op-amps and low-quality power filtering, while others use high-quality op-amps and well-filtered power to reduce noise and hum. While it's generally unnecessary to purchase an external power conditioner, a cheap CD player will often pick up more noise than a well-made player.