Most music these days (unless you are getting vinyls or something) is digital in format, meaning it’s stored in binary (aka ‘1’s and ‘0’s). Optical media (CDs/DVDs/Blu-ray) work by encoding those bits as a physical change in the disk.
The exact process varies by the type of disk. These can be physical pits (CD-ROM), darkening a pre-applied dye (CD-R), or by turning a normally-reflective material opaque (CD-RW). These are simplifications, but should for the most part get the point across.
Latest Answers