The first compact disc was sold in 1982, that is to say 40 years ago. This project is my anniversary tribute to this technology. No, we are not going to use it as data storage. It’s obviously impractical nowadays. Well, if you turn it this way, actually we will store some data... Not digital but rather visual and not exactly on CD but on its surface... Pick up your old CD-RW drive and some compact discs from your garage. Because we are going to burn images on a compact disk surface. With an incredible rainbow effect. No LightScribe, no LabelTag. No hardware hacks or gimmicks. A regular CD-RW drive and a regular compact disk.
Initially there were no practical reasons for this project. But…
1. You could make a souvenir or an original geek gift with some photo or other image. For example, burn the Discworld map. :)
2. Alternatively you could make an item for your quest or escape room with some riddle. You could supply your participants with CD Player for misdirection and make them figure out that they should look, not listen.
3. I’m not sure but maybe some holographic applications are possible. However, we are likely speaking about the infrared, not visible spectrum.
4. It might be possible to implement a copy protection algorithm. Since all compact discs are slightly different, you should be able to use timeouts between particular areas readings to ensure that a compact disc is the original one. Even an exact copy is not exact geometrically speaking. I believe such algorithms have existed during the CD era. Maybe this trick is possible with modern optical discs.
If you have other ideas, let me know.
Project's Origins and CreditsI know of at least two successful attempts to implement a similar technique. One was accomplished about 15 years ago by [argon] Instructables user. That code was more proof-of-concept than the universal method, but it was impressive! I suppose there was a huge amount of work behind it. Another attempt was made by a user with nickname [unDEFER] (no English documentation unfortunately). These two projects inspired me some time ago. And in fact my coordinate conversion code is mostly based on [unDEFER]’s implementation. I also used geometric parameters of some compact discs from that project. I acknowledge and am grateful to these developers for their contributions.
I played with color shades and different compact discs with moderate success and created a GUI with visual preview mode. I tried to implement a user-friendly solution but finally abandoned the project in 2008 due to a problem of calibration for every particular brand and type of compact disc that will be described further. Recently I found my old code and decided to share it. More as a tribute to the compact disc era, as I said. But maybe you will make some use of it (look for tips at the end of this text). I brushed the code up a little and ported it to modern Qt6. I considered porting to Python, but I still need C++ because audio track generation takes some time even on modern hardware.
A couple of my early experiments (sorry for bad quality, photos are from 2008):
The short story is that compact discs are optical volumes. Data is encoded in areas with different optical properties and organized in spiral. You might have noticed a visual rim on a compact disc surface between written and unwritten areas. So by generating specific data that will form darker and lighter areas it is possible to burn visible images on a compact disc surface. Sounds easy, isn't it? Just convert an image to polar coordinates and here you are.
The Long StoryYou may skip this section if you are not interested in technical details.
The long and real story is more complicated. If you really want to understand the concepts, I suggest that you read the so-called “Red Book” which describes all technical specifications. I am not going to retell the entire boring standard here, just name some key points.
Did you know? Compact disc formats specifications are called Rainbow Books. The first one considered Digital Audio Compact Discs and was named "Red Book".
The surface consists of “pits” and “lands”. They differ in light reflection properties. But it does not mean that “pit” is 0 and “land” is 1 or vice versa. In fact NRZI code is used to prevent long series of “pits” and “lands”. Which is good for data integrity but bad for picture burning. To make things worse, eight-to-fourteen modulation is also used, that is to say, each eight-bit block is translated into a corresponding fourteen-bit block according to lookup table. So if you are trying to write 00000000 and hope to see the darkest possible shade, it is translated to 01001000100000. And you can do nothing about it. The lookup table is constructed in such a fashion that it is impossible to have more than five 0s or 1s in a row. It decreases your color shades assortment dramatically. But it is still possible to pick several 14-bit values from the lookup table which will look differently. However, maximal contrast is unachievable. Not to mention scrambling and other significant details, the point is: even the simplest CD format uses a lot of uncontrolled data conversions and it is impossible to control each particular bit. If you are thinking about transferring this approach to DVDs or other optical discs, be ready to face even more technical magic.
But I still have not mentioned the real trouble you’ll face. All data is organized in one spiral that starts from the centre of the CD. And to make coordinates transitions, you should know its dimensions. You’ll need to know the size of the first circle and the step between circles of the spiral. Their acceptable ranges are defined in the standard, but precise values are different for every brand and sometimes for every pack of compact discs. The way to obtain them is a matter of guessing and spoiling a lot of compact discs. And this limitation must be the main reason why nobody has ever come up with a universal solution. I have included parameters of four compact disc types. If you are lucky enough to find one of them, you are likely to succeed. Otherwise you’ll need to make a test image with some rings and lines and try to calibrate your compact disc. It may take about ten iterations of guess-burn-repeat or more.
Preparing the SoftwareYou’ll need a compact disc writing tool and CDImage tool to generate an audio CD track. To compile it from source code, you’ll need the Qt6 library. Just run
qmake
and then
make
Alternatively you could build the project with Qt Creator if you installed it.
Picking Up an ImageClick Edit→Load image and select an image file. I recommend that you use a high-contrast image. No need to mention that you will not be able to burn full color images. Well, in fact every image will have a recognizable rainbow palette when you finish. You can move and scale the image:
- left mouse button — move image;
- double click — center image;
- mouse scroll wheel — zoom image.
Click Edit→Create track and select the model of your compact disc. If it is not in the list (which is likely), you may input geometry manually. If you know the geometry of some compact disc which is not in the list, let me know and I’ll include it into the distribution.
Depending on your hardware, conversion will take some time. Finally you’ll get a huge Audio CD track.
Burning Compact DiscYou could use any software you like. For example:
cdrecord -audio dev=<recorder_device> <generated_track>
Remember that you should create an Audio CD.
Comments
Please log in or sign up to comment.