The advent of digital music came about slowly over the last several decades, and was instigated because of the character of the earlier analog formats. Analog audio recordings had many benefits - analog saturation was introduced during the recording, mixing and mastering processes, and introduced a warmth and smoothness on the resulting audio tracks, however, the disadvantage, and it's a big one, is that it wears out in time and is susceptible to damage, such as scratches on a record, or gradual degradation of a tape.
Experimentation with digital music began in the 1960s, but the initial recordings sounded poor in comparison to analog due to the inferior sampling rates that were being used at the time. Finally, when optical recordings became available in 1978 with the advent of the video disc player, digital formats began to grow in acceptance as a standard, and when formally launched in 1983 with compact discs and CD players, it became widely acceptable as an effective way of reproducing music.
The late 1980s and early 1990s introduced recordable CDs, which not only caused the price to drop of both CD players and the CDs themselves, but also created a new industry where people could not only purchase music in a digital format, but also create it themselves. This also brought about further adoption of digital media into the mainstream as DVD technology was introduced and began to grow.
The portable digital player scene appeared in the late 1990s, with Sony offering one of the first widely available players, and seeing Apple's iPod grow to what is currently the most popular portable music player by far. The decrease in hard drive storage costs, coupled with increases in storage options with newer technologies like recordable DVDs and portable flash drives, has caused an explosion in the downloading, storage, and use of digital music, with personal collections reaching beyond thousands of songs, gigabytes of data, and vast collections of CDs.