Building an ESP32-based CD-Audio Player (yes, in 2025) - Page 1
Forum section: electronics / projects

author: akasaka
author_rank: Regular Contributor
timestamp: March 10, 2025, 02:59:58 pm
content: Many of you may know the cheap IDE CD drive control boards sold on Taobao et al, as well as the countless projects accomplishing the same task — starting with the infamous ATAPIduino, and a handful of PIC-based projects just among those that I've seen.Back in my childhood I had a crazy dream of building my own CD player, but a CD drive cost a fortune, and a microcontroller development environment a hundred times more. But in this day and age, after getting somewhat hooked on developing for ESP32 I decided to try my hand on a similar project, and crank it up to 11.What can it do?Read the CD Audio TOC from the drive (I tried making an ISO9660 VFS driver too, but because I copied the I2C schematic from ATAPIDuino, the speed is too low, so it's useless)Request the drive to play/pause/seek/etc — either in sequential or shuffle mode (no program playback yet). The audio is then fed to a Wolfson WM8805 and a PCM5102 DAC with a DC-coupled output. I don't believe in differences in digital audio gear sound, but it does sure sound fancier than my Sony CDP-790 :PIf the drive is a changer (e.g. Nakamichi MJ-4.4, or TEAC CD-C68E) it can also ask it to change discs, and once a disc finishes playing it will start the next one in the stack. Albeit my C68E has been acting up so this is glitchy/untested for the time being.Fetch metadata for the track names and artists using CD TEXT (if the drive supports it), or MusicBrainz, or CDDB (yes, I used the real libcddb from 2005 lol)Cache that metadata in flash with compression, so you can probably fit your whole collection (or remainder thereof) in the littlefs partitionDisplay karaoke lyrics from multiple different repositories in sync with the music playing and with auto font sizes (latin/cyrillic: 16 and 8 px tall, japanese: 16/12/8px tall)Send now-playing status and scrobble the playing tracks to Last.FM (using login+password auth)Receive internet radio stations in MP3 and AAC formats, with up to 6 presetsReceive music from a cellphone over Bluetooth (SBC only) and control it (play/pause/stop/volume)All of this is controlled either from a 8-button front panel, or from a Playstation 2 DVD remote (chosen because I find a whole bin of them in every HardOff I go to, and they feel nicer than the "card remotes" you can buy cheaply online while being useless for 99% of people)Maybe some day:New board revision with an IDE bus that's faster than an average FDD back in the dayConsequentially, reading MOD/XM/S3M/IT music, and maybe MP3/M4A/FLAC too, as well as omitting the requirement for a digital output on the drive itself (and maybe being able to use SATA/SCSI drives through an interface adapter, huh!)While revising the board also slap a chip that does analog radio (AM/FM+RDS)... and a hardware MP3/AAC codec just to make things easier down the lineDemo of Karaoke playback:Code:https://github.com/vladkorotnev/cd-player/tree/wip/firm(WIP branch)

author: globoy
author_rank: Frequent Contributor
timestamp: March 10, 2025, 03:26:11 pm
content: Good luck! It is fun seeing these retro-ish projects where a single individual today can replicate devices that took a whole team back in the day.

author: akasaka
author_rank: Regular Contributor
timestamp: March 11, 2025, 05:11:33 am
content: On one hand yes, on the other — we are standing on the shoulders of giants basically. This one is only possible because someone figured out all the physics, high speed stuff, and most of the redbook standard and put it into a tiny convenient box with an interface bus on it, and someone else did all the radio et al work, and someone accumulated a database of lyrics, tracklists, and so and so — just so that a monkey with a bunch of capacitors and a copy of Diptrace like myself could put it all on a board with more silkscreen memes than actual design effort, and have fun of the modern equivalent of writing a CD player app for MS-DOS while still getting a perfectly usable result :-)

author: johnboxall
author_rank: Unknown
timestamp: March 11, 2025, 06:09:36 am
content: You might find this project of interest, or at least for some background material:https://www.siliconchip.com.au/Issue/2007/November/Playback+Adaptor+For+CD-ROM+DrivesErrata is in the following month.

author: akasaka
author_rank: Regular Contributor
timestamp: March 11, 2025, 06:40:37 am
content: Interesting, I'll have to check if the central library in Tokyo has a copy — the link is paywalled. However the huge atmega chip in the middle and the 1602 LCD reminded me of all those boards up for sale on websites from China — maybe that's what they knocked off.I'd be curious about two things if the article has it:1. What's up with all those drives that have a correctly labeled SPDIF connector but don't output anything there? Do they need a special mode select command to enable that? I have a panasonic that otherwise works perfectly which makes it a bummer.2. How does one get the Master/Slave to work? I tried doing the sequence of: bus reset, drive select register to master, init sequence (self test, identify, etc) — drive 1 responds as expected. Then drive select to slave, init sequence again — and I get a hang in the second init sequence as if the drive 2 wasn't there at all. The drive is definitely working when rejumpered to master and left alone on the bus. The preview seems to have two drives so I wonder if they figured it out? It'd be cool to use two drives as a makeshift changerAlso a small funny — I took apart my non-changer TEAC DVD DL burner, and a) it turned out to be a Sony on the inside! b) it has an unpopulated Play button position which works! Not expected in a drive from 2006!Upd:added a video overviewing the functions of the firmware