MadSci Network: Computer Science
Query:

Re: How can a CD have both music and data at the same time?

Date: Tue Feb 8 15:07:14 2000
Posted By: David Ehnebuske, Sr. Technical Staff Member, Software, IBM Corporation
Area of science: Computer Science
ID: 947091646.Cs
Message:

April,

You asked how it can be that some music CDs can also serve as CD-ROMs. That's a really interesting question and like most such questions, there are multiple levels of answers. Let's build up it up a little at a time.

First, it's important to know that the music on a CD is just a (really big) bunch of digital data. That is, during the process of creating the CD the music is converted from an analog signal (a voltage that changes with time) into a whole lot of numbers. This is done by sampling the music on the left and right channels 44,100 times per second and creating a number (in the range 0 and 65,535) that represents how loud the music for that channel is at each sample point. This process converts each second of music into two streams of 44,100 numbers, one for the left channel and one for the right. So, one hour of stereo music would be converted into 44,100 (numbers per second) x 2 (channels) x 60 (seconds in a minute) x 60 (minutes in an hour) = 317,520,000 numbers in an hour of music. It is this long stream of numbers -- along with a few other numbers that tell where the music tracks begin and end -- that is recorded on a music CD. When a CD player plays a CD it reverses this process: It reads the two streams of numbers back and, 44,100 times each second, converts a pair of them into analog signals for the left and right channels. These signals are then sent as voltages to the left and right earphones or to the stereo amplifier.

Computer files, which is what are on CD-ROMs, are similarly just a whole bunch of numbers. For example, a plain text file consists of a sequence of numbers in the range of 0 to 256, called "bytes", each of which represents a character such as "T", "a", or "?". There is a code (it's usually the standard one, called "ACSII") that tells what number to use for each character. For example "A" is the number 65 in the ASCII code, and "B" is 66. Other kinds of computer files are also made up of numbers, sometimes byte-sized ones, sometimes bigger ones (like the ones used for CD music), and sometimes other sizes or a mixture of sizes. What's recorded on a CD-ROM is the set of streams of numbers that make up the computer files stored on it, along with a few other numbers that tell where the files begin and end and what their names are.

Notice that both music CDs and CD-ROMs are just recorded streams of numbers -- they're basically two different uses for the same kind of thing. Further, they're physically compatible, by which I mean that the way the numbers are recorded is identical. There's a technical document called the Red Book that specifies how numbers are represented on the compact discs. Simplifying it a little bit, the numbers are recorded as sequences of tiny pits and places between them called "lands". The pits and lands are manufactured into the shiny metal layer that's sandwiched between the two plastic discs that make up a CD. The pattern of pits and lands represents the numbers recorded on the CD. The recording is a kind of code called a "binary" code because it is made up of only two symbols -- pits and lands. Conventionally the symbols in a binary code are called "bits" and are represented by the symbols "0" and "1". On a CD, a pit is a 0 and a land is a 1. The number of bits that make up the sequence representing a number depends on how wide a range of numbers is required. For small ranges -- text characters, for example -- it takes eight bits. For example, the character "A" whose number we noted above is 65 would be represented as 01000001 (i.e., pit, land, five pits and a land).  For numbers needing a bigger range of values each number takes more bits. Sixteen are required for CD music.

So...How is it that a single CD can be both a music CD and a CD-ROM. Well, since they are physically compatible in how they record numbers, its really a matter of putting the right numbers in the right places on the CD. The person making a combo music CD / CD-ROM needs to:

  1. Put the numbers for the music on one part of the CD and the numbers for the computer files on another.
  2. Put the numbers that tell CD players where the music tracks begin and end in the right places (as specified in the Red Book) so that when the CD is in a CD player the CD will be able to find where the tracks are.
  3. Put the numbers that tell a computer where the files are and what their names are in the right place so that when the CD is in a CD-ROM drive the computer will be able to find the files.

The technical document that describes how numbers are to be placed on a CD-ROM, called the "Yellow Book," builds on music CDs' Red Book. It not only specifies how numbers are to be placed on a CD-ROM but specifically ensures that it is possible to put both computer files and music on the same disc. It does this by telling how steps one and three should be done so that step 2 can be done per the Red Book.

As you surmised, the structure of a DVD is similar to a CD. Data is stored in pits and lands but they are very much smaller. They are smaller because it takes a lot more numbers -- and hence a lot more pits and lands -- to represent a movie than it does an audio recording. The process is conceptually similar, though. Each picture in the movie and the sound to go with it is turned into a big heap of numbers (the process is much more complex than it is for stereo sound) and these numbers are recorded as pits and lands in a binary code. Unlike CDs, there is no real distinction between a movie DVD and a computer DVD -- the movie is stored in computer files. You can verify this if you have access to a computer with a DVD attached. If you put a movie DVD into the DVD drive and inspect its content as though it were a computer DVD you will see that there are some files on it, one of which is really huge. The really huge one is the movie itself. The others are supporting files that a DVD player needs to help it play the movie, extra scenes, and the like.

A DVD player is basically a specialized computer whose only job is to play DVDs -- most of which involves converting streams of numbers back into pictures and sound. The program that does this is built into the DVD player. The special features of DVDs are really just variations on the basic process of playing a movie. They generally involve playing other files than the big movie file, jumping to a specific point in a movie file before starting, decoding a different stream of numbers to give you different languages, and similar things. All of these are done by the program built into the DVD player.

Additional information on CDs and DVDs -- including more than any reasonable person would want to know -- may be found on the web. For example, click here for an especially interesting site on how CD-ROM's work. Using any of the many search engines, try asking for combinations of several keywords and phrases like "compact disc digital audio", "red book", "yellow book", "cdda" (which stands for "compact disc digital audio"), "pits", "lands", "DVD specification", and the like. When I tried it on www.altavista.com I got lots of interesting stuff back.

I hope this helps.


Current Queue | Current Queue for Computer Science | Computer Science archives

Try the links in the MadSci Library for more information on Computer Science.



MadSci Home | Information | Search | Random Knowledge Generator | MadSci Archives | Mad Library | MAD Labs | MAD FAQs | Ask a ? | Join Us! | Help Support MadSci


MadSci Network, webadmin@www.madsci.org
© 1995-2000. All rights reserved.