An Arduino And A CD-ROM Drive Makes A CD Player

In an age of streaming media it’s easy to forget the audio CD, but they still remain as a physical format from the days when the “Play” button was not yet the “Pay” button. A CD player may no longer be the prized possession it once was, but it’s still possible to dabble in the world of 120 mm polycarbonate discs if you have a fancy for it. It’s something [Daniel1111] has done with his Arduino CD player, which uses the little microcontroller board to control a CD-ROM drive via its IDE bus.

The project draws heavily from the work of previous experimenters, notably ATAPIDUINO, but it extends them by taking its audio from the drive’s S/PDIF output. A port expander drives the IDE interface, while a Cirrus Logic WM8805 S/PDIF transceiver handles the digital audio and converts it to an I2S stream. That in turn is fed to a Texas Instruments PCM5102 DAC, which provides a line-level audio output. All the code and schematic can be found in a GitHub repository.

To anyone who worked in the CD-ROM business back in the 1990s this project presses quite a few buttons, though perhaps not enough to dig out all those CDs again. It would be interesting to see whether the I2S stream could be lifted from inside the drive directly, or even if the audio data could be received via the IDE bus. If you’d like to know a bit more about I2S , we have an article for you.

49 thoughts on “An Arduino And A CD-ROM Drive Makes A CD Player

    1. If I were going to actually handle the audio data with the processor I’d choose something with a bit more performance than an AVR-based Arduino. A Raspberry Pi would do nicely, and it conveniently has an i2s output on its SoC.

          1. Really if we were just trying to be pragmatic and not trying to hack anything, you can get a functioning CD player with audio output at a Goodwill store for $3-10. But then the page wouldn’t be called hack a day.

      1. IIRC you needed about 300Mhz of x86 to playback audio digitally off a CD without stuttering… that’s while you’re doing something else like playing solitaire or light browsing. So maybe 200Mhz equivalent dedicated? IDK if it was necessarily about CPU speed or whether the drive supported DMA and 32bit transfer, was late 90s when it became a “thing” not to need the analog cable to your soundcard.

        1. Had a HP Vectra 486 @ 33 Mhz, 4 MB of RAM, and I was able to perfectly listen to any audio CDROM. I even renember recording some songs using ESS AudioRack at 44.1 Khz 16 bit stereo to my 200 MB HDD. I never had any issues whatsoever on the Playback.

          1. That sounds like a system that pretty much guaranteed was built with the analog audio cable to the sound card, which is not what is under discussion. IBM XTs could fit an 8 bit SCSI card, control a (Probably single speed) drive and play analog audio.

          2. Yes we used to rip tracks to our hard drive as well to edit out the cuss words so we could play them on college radio using a 486

            But that was analog audio going to the adc of the sound card not decoding the raw stream

        2. I had a 133MHz 486 that was able to decompress and play MP3 files (under Windows) with ease. Uncompressed PCM audio on a CD is effectively a particular format of WAV file. Windows 3.11 would happily take a crack at those!

          Perhaps you’re thinking of the CPU speed you’d need to use an ATAPI CD burner reliably? I had a P3 500MHz that shipped with a 4x burner, so that feels in the right ballpark.

        3. I was digitally ripping CDs in 1997 on a Pentium machine clocked at 120MHz.

          The processor was not a limiting factor in any appreciable fashion that I can recall: It’s just IO.

          1. There’s no constraint to ripping the CD on a Pentium 60, doesn’t mean you’re doing to do it in real time. Perhaps it was the early software but in 1997 I recall a buds P100 take about half an hour a track to rip a CD.

    2. The problem is that you’re not getting 16-bit samples at 44.1kHz over ATAPI — you’re getting raw data with error correction multiplexed with some control words. As others mentions, it probably requires much more processing power that Arduino can provide.

    1. Decoding HDCD would require that the processor handle the data (there are software decoders), or that you use a DAC with HDCD processing.

      SACD is another kettle of fish entirely. That requires a DVD drive, and not a standard one at that but one that’s capable of reading the special wobble encoding for the decryption key. (It’s not in the DVD-standard data that can be read with a normal DVD drive.) You would have to harvest such a drive from either an SACD player or a first generation PlayStation 3. And to do it right you need a DAC that accepts DSD input.

      Then there is DVD Audio. For that, you need a DVD drive and the ability to decompress MLP (in this context, Meridian Lossless Packing). For most discs you also need the ability to crack DVD CSS.

      Doing any of those things would probably require a CPU with more power than an ATMega328P. (This project uses an Arduino Pro Mini.) One of the ARM-based Arduinos might be up to the task.

  1. One catch is that many CD-ROM drives don’t have an S/PDIF output. Older ones had an analog audio output that you could connect to an input on your sound card or motherboard. Newer ones don’t even have that; they count on the host computer to read the data from the CD and send it to the computer’s DAC. That’s how all modern versions of Windows play CDs, even if you have a drive with an analog output.

    1. The really old ones didn’t even need software, some came equipped with headphone jack, volume control, and basic play / skip buttons on the front. Supply power and you could jam out to tunes without a computer at all.

      1. I have one of these: I use it to listen music at bedtime. I have found a 5 1/4 external disk enclosure with a power supply. Audio from the output jack is a bit noisy, so I used the soundard out from the back and a tiny IC amplifier with a couple of LM386.

        1. Extra bonus points for those of us that have CD drives that use caddies. I still have some caddies kicking around in my basement and I think I might still have an old HP XU90 packed away with a caddie type SCSI CD reader.

          The first data CD reader I had was a full height caddie type Sanyo in its own external box with two huge blue Amphenol 50-pin SCSI connectors on the back. There were a bunch of drivers and statements that had to be loaded in CONFIG.SYS and AUTOEXEC.BAT to get the thing to work and it ate up a lot of the lower 640K of memory, so it was difficult to run many programs. Windows 386 was barely usable with multimedia extensions that had to be loaded separately. Those were the days!

          1. Some of those are around somewhere, have had verrrrry little luck with SCSI stuff… got bits and pieces I picked up to play with, but either it’s my Achilles heel or very little of it works. Think I got one of the CDROMs working, but it’s value of working wasn’t high enough to enable booting off, which was required on the system I was putting it in. May never have supported it on that drive. I think that setup is still intact somewhere with a PIII in it and couple of SCSI hard drives, my one success at getting anything working. I didn’t get round to trying external devices, maybe haven’t got the right cable, but one of those is a HP scanner, and another is a “$5000” hard drive, full height 5.25 in a box, and a whole gigabyte…. which was what made it worth 5k list in the early 90s…I keep eyeballing the enclosure for a mediaserver or something… ima get my $2 worth out of it’s hide somehow. But anyhoo, that caddy CD which works for given value of works, may end up in an XT or 286 with an 8 bit SCSI card which I have two of hanging around.

            But for media controls, the best one I ever saw to look out for, is a SoundBlaster brand, with blue and orange splash on the front, six speed I think it was, that had a pop out remote control.

          2. early Sony SCSI caddy drives now need a half dozen capacitors replaced to properly eject. fyi, it’s not difficult to replace the leaky caps if they are present in whatever drive people happen upon.

          3. In the mid-late 90s there was a cool portable CDROM drive that also had a SCSI interface. It was more expensive than a “normal” personal CD player and only read CDs at 2 speed… But I really really wanted one for my Amiga. Definitely a niche product but gosh it would have fit that niche well.

    2. If the goal is just to listen to or output it the type with native analogue out is even easier – you just connect it straight up to the speaker (or an amp if the goal is line level outputs). No need for the spdif converters in your build.

      With the later ones you are screwed – no way the little atmega is going to handle CD audio throughput in real time. I’m sure you could get it to read and then playback (probably in lower quality), but its got to be too much for it process the CD audio stream and in real time drive a speaker..

  2. Long time ago I used the S/PDIF output of such a CD-player and connected it to my stereo set.
    It did sort of work, but for some reason the audio sounded atrocious. I got the Idea that only 12 bit or so of audio came out of that port. It was quite strange.

    Back then I had some plans of connecting it to a digital input of my PC and compare it with the version extracted via the IDE port, but I never got around to actually doing that.

    And then, probably some 15 years ago I sold my collection of 150CD’s for around EUD60. Just in time before all interest in that archaic medium was lost.

    1. A frequency issue would be my bet, not the bits – way back then I doubt if anything automatically listened and adapted to different frequencies.. But take that with a pinch of salt I was too young back then to know or care about this stuff..

      1. Perhaps paulvdh was playing early CDs with pre-emphasis and the stereo was not applying (or did not have the ability to apply) the matching de-emphasis. The flag to trigger that is in the data stream, but that doesn’t necessarily mean that the stereo recognized it.

    2. Your stereo might have been expecting 48 Khz while CD Audio is 44.1 Khz. 44.1 Khz for CD exists only because that’s the exact number of sample per second that could be encoded onto a PAL U-Matic video tape with a PCM to analog converter. NTSC tape could have encoded slightly higher due to more frames per second even though it could hold less data per frame but it wasn’t the tidily precise 44,100.

  3. Just get a Plextor CD drive and read the audio out over SCSI. That is how we did it when some band had used a CD-R as their master and they wanted CD’s pressed from them.

  4. Cool! Reminds me of the days of DOS and Windows 3.x/9x,
    in which the CD-ROM drive itself handled the actual audio playback.
    The latter often used MCI to control functions like play, stop, go backwards, go forwards, eject..
    In these days, it was wise to still have a dedicated audio connection (analog, spdif) between soundcard and CD-ROM drive.

    Ironically, on the other hand, the use of CD-ROM audio in PC games ended the era of dynamic used that used MOD files, FM synthesis or MIDI (MT-32, SC-55, XG etc)..

    1. If I remember correctly, Windows 98 was the first version to offer the option of playing audio CDs using digital audio extraction (DAE) instead of the audio output from the drive. DAE generally sounded much better because drives typically had terrible DACs, and because the audio cable from the drive to the motherboard or sound card would pick up a lot of noise. But they couldn’t yet eliminate playback through the audio output because some older drives did not support DAE.

      CD playback on modern systems always uses DAE. Some later PATA drives omit the audio port, SATA drives never had it, and USB has no ability to pass along analog audio (aside from re-digitizing it and making the drive also look like an audio input, but that would be really silly).

  5. Most SCSI CD-ROM drives have a “test mode” jumper that makes them play (or replicate as the manuals stated) audio out their analog output without needing anything else.

    The first operating system that could decode CD-Audio over the data cable was Be-OS, though some drives back then weren’t capable of doing it.

    1. True, yes, some drives could only cope with a data format, and of only one kind, what were all those formats you had to care about instead of it just working, like most every drive since ~1998? high sierra, red book etc. ? Some drives couldn’t read a boot block, so if you stick ’em in a “too modern” system that allows CD boot, they won’t.

      1. Red Book is CD-Audio. There were orange, green, and yellow books too, IIRC without googling, dunno if there was a blue one. Also High Sierra and ISO9660. There was a meeting of optical disc and computer industry people at the High Sierra hotel (hence the name of *that* format) to hash out and firmly nail down all these “books”. Someone brought a pack of different colored folders and the formats were assigned their colors simply by the folder the person who gathered the final papers stuck them into. If whomever collected the papers for CD-Audio had grabbed a blue folder instead of a red one it would have been called “Blue Book Audio” all these years. If they’d held the meeting at Timberline Lodge or Chula Vista then that’s what the High Sierra format would be instead.

  6. Last time I saw a similar project around the year 2000 it was using a 8051-based CPU connected to IDE directly, powered with PC power supply, a 2×16 LCD and analog audio taken directly from the CD. It’s nice to see how far DIY electronics went:
    – Arduino, check.
    – cheap OLED display, check.
    – whole IDE driven using 2 pins with I2C expanders, check.
    – SPDIF to I2S, check.
    – I2S to analog, check.
    – step-down converters from China, check.
    – re-use surplus laptop power supply, check.

  7. I have done simular on RaspberryPi by using a IDE to USB convertor cable. Using RISC OS i was able to play cd and read data no problem and control from the OS.

    Any IDE CDROM has onboard DAC from which you can solder some audio cables for output port or simply you can use the output socket on the front panel if you wanted speakers or headphones additionally.

  8. This isn’t really playing a CD with an arduino. It’s more like using an arduino as the UI to control the cd-player. All PC cdrom drives already have everything necessary inside them to play back audio. All this arduino and even your PC playing back an audio CD was doing is sending commands over the IDE bus. Basically play button is pressed, next button is pressed, prev button is pressed, seek to MM:SS, stop button is pressed. The the drive then just spits out the audio over the 4 pin analog, 2pin spdif over to the sound card where the sound card then sends it off to the speakers. There were even some cdrom drives back in the 90’s that had play/next buttons on the front of the drive themselves. You could literally hook up a power supply to the back of these, headphones/amplified speakers to the front headphone jack, pop in an audio cd, and press the front panel play button and it would play with no PC attached at all to the IDE bus. It wasn’t till towards the late 90’s/early 2000’s when an audio cable between the cdrom and sound card was no longer required, because playback software essentially ripped the CD over the IDE bus and chewed CPU cycles to decode the “ripped” disc in realtime and play back the audio. There’s really no reason that a classic 8088/8086 PC couldn’t play back audio cds, assuming you could find an 8bit IDE card, rare, but they do exist. and that the DOS cdrom drivers would run on the 8088/8086. It doesn’t matter that these CPUs are woefully underpowered because they have nothing to do with the audio play back other than sending play, next, prev, seek, stop commands to the drive.

    1. Back in the late 90’s I had a XT Clone 8088 and came across an IDE/Floppy Controller that worked with a 8Bit ISA BUS but only limited it to a single IDE when used on a 8Bit ISA BUS. Anyway, I tossed in a Creative IDE 2x Optical and with a Bootdisk I was able to play Audio CDs. The Software ran super slow but once the CD started it was fine. I had to use External Speakers on the Headphone Jack on the Drive. Didn’t work well reading Files.

  9. Is the conversion from spdif to i2c to analog even necessary? Not to mention the drive likely already has a 4 pin analog output right next to the spdif. I find it hard to believe considering how long spdif has been around there isn’t some purpose built 8 or 16pin dip package that can’t directly take an spdif stream to analog. After some googling, the chip on the bottom side of this device seems to do just that https://www.aliexpress.com/item/32844859074.html

  10. Pretty cool. I’d like to see something with more control over the drive. Years ago I wanted to see if I could make a CD drive run faster than its max RPM and for sustained time to see if I could replicate the exploding disk tales we have all heard. I also wanted to see if I could have manual control over a DVD burners laser to do a constant burn on the disk. I was looking at making graphene by using a laser to burn graphene oxide or sucrose with the spirals in the disk causing it to burn a single long string.

    1. Probably already drives out there on ebay capable of fine control of the laser. How open the APIs are for this control is unknown. There were two types of “label burning” tech back in the day. One of them used a proprietary disc with a thermal sensitive layer on the label side. Think thermal receipt paper. Once you burned your data, you’d flip the disc over and then “burn” the label. This was god aughful slow, something like 15-30min to burn a full disc label. This was b/w only, but you could burn the label time successive times to make it darker, or if you were creative with your label design create a grayscale image by only reburning parts of the label that needed to be darker. The other one burned a label on the data side of any disc. Though to do this you couldn’t use the entire data side of the disc. So if you burned something like 200MB of data to a CD, you could then “label” the unused data portion of the disc. These wern’t the easiest to read the label due to needing the light to hit the disc just right to read it.

      1. Yep, that would have been Lightscribe and Labelflash for the label surface and DiskT@2 for the data side. Both required special disks. Funnily enough Wikipedia has updated some of it’s pages and there was another one I didn’t know about, Labeltag. It might just do what I wanted.

Leave a Reply to RW ver 0.0.1Cancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.