DIY CD drive based on a computer CDROM

Getting the ball rolling...

I stumbled across this thread yesterday and am very excited about the idea. I don't have any experience in this kind of stuff, but I am a competent programmer (in C, not assembly) so if someone could point me towards some info to help me get up to speed that would be awsome. I am also willing to help in any other aspect (organizing, etc...). Unfortunately right now my CD player is quickly dying, so I am most interested in a cheap short term solution. If I have been following this correctly most IDE drives have I2S output directly off of the CD player so if I give the CDROM power and attach a DAC very close to this output is there any reason I can't get away with not using something like LVDS (another subject that I really haven't researched at all). What I'm driving at is can I build a dirt cheap NonOS tda1543 DAC and attach it more or less directly to the CDROM drive? Sorry for my lack of knowledge, hopefully I'll be able to rectify that as this project progresses.
Doug
 
Some difficulties with the approach you're taking...

Kuei Yang Wang said:
Given that DAE and co work completely different to syncronous "CD-Player" mode the basics make no sense at all. Get a "lets buy it together" group by on a Philips CD 713 - it will do better and lend itself much more to high performance mods than a CD Drive. And it comes with buttons and Display PLUS CD-Drive and even a decent DAC for little money.

Hi all,

I am a newcomer to this thread, but I've read all the posts. And I'm a newbie to DIYaudio, so feel free to correct me. :)

Great project, guys :) . I'll be interested in anything that comes out of your efforts if I can beat commercial transports with it. And in theory, a CD-ROM drive can be used to that end.

Though I'm new to DIY audio, I've done a bit of reading and work with digital audio extraction from CD-ROM drives, but at a higher level (i.e. above a general-purpose Unix kernel). Going by what I've learned there, I feel that there are some difficulties with the approach some of you seem to be advocating.

Firstly, I assume that you want to build something which will beat most commercial transports. If that is not one of your aims, please ignore the rest of my post; you may be in it just to get an inexpensive but mediocre CD spinner for a spare unit or something... perfectly logical. However, if you're in it for accurate reproduction, then there are some issues only Kuei Yang Wang, DJ and very few others seem to be raising.

The problem, as I understand it, is that extracting digital audio from a computer CD-ROM drive is notoriously difficult, because neither the mechanics nor the electronic command interface are designed for steady, accurate, real-time streaming data. It is designed to be a data drive which also does audio after a fashion.

If we want to use this cheap drive to build a good audio transport, then there are difficulties which most of the posts here appear to be ignoring. Since I'm no expert on the subject, may I suggest that those of you who want to build this transport to beat commercial hi-fi units please study the CDParanoia FAQ? CDParanoia is a high-end, intelligent, audio data extraction program (a "ripper", basically) for Unix/Linux. Specially see the question titled "I can play audio CDs perfectly; why is reading the CD into a file so difficult and prone to errors? It's just the same thing." I couldn't describe the problems better myself. (Some of the problems mentioned there are related to the non-real-time behaviour of a large OS, which our uC-based system will not have. But the other problems will all apply.) And then, if you have a Linux box, I suggest that you play about a dozen of your badly-handled CDs, once through a streaming audio app like XMMS or KSCD, and once by ripping to HDD using CDParanoia and then playing the ripped file. See, sorry hear, the difference. You may not need good amps/speakers to hear the difference; I hear clear differences through my laptop speakers on some of my worse-off CDs.

Ripping audio tracks from a CD using a CD-ROM drive without errors is really difficult, and only some of these difficulties are to do with the latencies of a non-real-time OS. The real difficulties are two-fold:
  • There are errors in the data, which the CD-ROM drive does not bother to correct in streaming mode or even report to the higher software layers. Many of these errors are not due to damaged disks, but due to problems with the drive. Sometimes, the errors are not "wrong data read" but loss of synch (i.e. same data read twice or some data skipped in the stream).
  • Data does not come out of the CD-ROM drive in steady real time. You need to buffer it to play it back. DJ is spot-on on his insistence on buffering the data, I feel. There's no alternative to this, if you want an accurate transport.

CDParanoia is a very powerful program which compensates for all these problems. It is powerful not because it has featuritis, but because it does a bloody difficult job with little or no help from the hardware. IF you want to build a transport with true high-end performance, you have only two options, it appears:
  • Use a high-end mechanism with associated high-end basic error-correction and timing electronics, and add your control electronics on this. This way, the CDParanoia sophistication is built into the drive itself. Cheap twenty-dollar CD-ROM drives need not apply. OR
  • build large buffers outside the CD-ROM drive, in your control electronics, and build the complete functionality of CDParanoia into your controller.

Pardon me if I'm wrong, but very few of us, other than Kuei Yang Wang and DJ, on this thread seem to appreciate this. Or else, most of you are intent on a rough-and-ready El Cheapo transport, and I'm misreading your objectives.

Many Windows-based CD rippers rip junk onto your hard disk if your CD or your drive are anything less than perfect (most are not). And they do this without even letting the user know it. People naively believe that the ripped data is a bit-by-bit copy of the audio CD, but even CDParanoia cannot guarantee bit-by-bit accuracy, let alone the corner-store Windows-based CD ripper. This ripping of inaccurate data, I suspect, accounts for most of the reports of "CD-Rs don't sound the same as the original CD." Obviously they don't. You're not playing my song, so to speak. :)

I have a good IBM laptop. IBM hardware is usually very reliable. When I play some of my audio CDs on its CD-ROM drive in streaming mode (i.e. tell the drive electronics to "go play the track" and get out of the way), they give me audible clicks and pops. Some audio CDs actually get stuck while playing. However, when I rip from the same CD through the same CD-ROM drive using CDParanoia, and then pay the WAV file, the audio is perfect. It is (within DAC limits), the same song as that on my SACD player.

One question that comes up: how much RAM buffer? You will need at least a few minutes worth of buffer to be comfortable. CDParanoia will need to re-read tracks over and over to fix problem areas. (Watch CDParanoia ripping your CDs on a Linux box, see its progress meter, and you'll see what I'm referring to.) You could have done with a smaller buffer if you had let your CD-ROM drive rip (pun unintended) at top speed, but you can't do that, because you have already mentioned that you want to cut down the speed to reduce mechanism noise. So, knowing the kind of latencies CDParanoia takes for error correction on bad patches, I'd not be happy designing this transport unless I was allowing for at least one minute of buffer. Ten seconds would be the absolute minimum, and this would fail on anything worse than almost-perfect CDs or almost-perfect drives. Allowing for temp areas and scratchpad memory, I should think 10-20MB of RAM would be a good idea.

One interesting data point: when CDParanoia rips a typical CD even using a CD-ROM drive capable of 52X reads, it takes at least 10-15 mins on a zero-loaded Linux box. This means that it rejects high-speed reading anyway.

Which brings me to another related point: DJ is spot-on when he prefers an HLL for programming. I'd second this, not just because of the reasons he has stated (all of which are 100% valid) but also because accurate ripping needs complex algorithms and data structures. This is not a bit-banging job to be done in assembly by "real men". This is a grown-up software project, to be done by "real programmers." I have worked in the software profession long enough to know the difference and I am too old to have any patience with the former breed. :) "Testosterone and good sense rarely mix." -- Old Jungle Saying. :D (Of course, if you are not familiar with any HLL, you don't have a choice. However, beware: this will be a very difficult job in assembler if you want to target high-end performance.)

Therefore, frankly, I fail to understand how a "basic" system based on a twenty-dollar computer CD-ROM drive will give you anything remotely resembling even boom-box quality CD playback. :confused: (Yes, a boombox drive will give you better audio, more consistently, than many CD-ROM drives I've seen.) You have to go the whole hog, build large buffers, and write sophisticated ATA control, error-detection and retry algorithms.

I'm new to this field, so please correct me.

Tarun

PS: I've deliberately avoided bringing up another requirement for making a top-quality transport from a CD-ROM drive: a jitter-free clock... others have already highlighted it. I wanted to focus on things I thought some of you appeared to be unaware of.
 
Thanks for your long post Tarun. I am afraid I have to agree with most things you said ;)

I am aware of the complex issues involved in creating such a system. Though I thought that ripping audio CD's is nowadays is less of a challenge than a few years ago. I own a Plextor CD-RW drive that features jitter correction (I think). Not jitter reduction of the SP/DIF but sample jitter removal. I don't know how well the system grabs. I think quite ok. At least I never get 'pops'.

After thinking a while about these issues I realized I'd personally prefer a very high quality USB sound card solution over a complex CD-rom player solution. Better user interface, faster response and a possibility for a large music database! A 120 Gb drive could store a large part of a CD collection, especially when compressed! (preferrably lossless of course!!!)
A PCI solution would be even better (less latency), but much harder to make. I would like to find a cheap sound card solution that has a crystal with a convenient clock frequency to replace. It would be cool to have a sound card with an option for a clock input to synchronise with the DAC!!!

Fedde
 
Alternate approaches

fedde said:
Thanks for your long post Tarun. I am afraid I have to agree with most things you said ;)
Cool! :) And here I was, bracing myself for flames. :flame:

Though I thought that ripping audio CD's is nowadays is less of a challenge than a few years ago.
I feel exactly the opposite. Today's drives are flimsier, less accurate in every way; I ascribe it to lack of market demand for accurate streaming DAE, and unrelenting price pressure. Probably the best CD playback mechanisms on computers today are CD writers, where there is much greater technical demand for steadiness and accuracy. Plextor makes good writers which have superb mechanisms and control electronics, for instance. I'd expect them to cost more than USD 100.00, street price.

I own a Plextor CD-RW drive that features jitter correction.
Does "CD-RW" mean you have a writer? If yes, I think it'll behave much better than the average twenty-dollar playback drives.

However, the rest of this thread does not seem to be discussing drive selection at all. Most of the posts seem to be gleefully talking of twenty-dollar drives. One or two posters have posted photos of such drives. I don't know whether they'll get anything more than jittery boombox performance from them.

If the rest of us here want good performance from the drive's built-in play operation, then we need to select drives very carefully. These drives may have to be good (i.e. not the lowest-end) CD writers, which may then be more expensive than a ninety-dollar DVD player from Fry's, and may deliver S/PDIF audio worse than the DVD player, without significant software assistance (read: CDParanoia). In that case, we need to be aware that whatever our objectives are, they are not going to be "killer transport at dirt-cheap prices." At best, we can aim for "fair to middling transport at prices cheaper than commercial players."

I don't know how well the system grabs. I think quite ok. At least I never get 'pops'.
Even my laptop's drive gives me pops only on certain disks, which are partly damaged. Other disks play okay. My point was that the same disks play smoothly on my Sony SACD player. I fear most readers of this thread may be taking the performance of my "mass-market" Sony player as a base level, and hoping for something better in this CD-ROM-drive DIY project.

After thinking a while about these issues I realized I'd personally prefer a very high quality USB sound card solution over a complex CD-rom player solution. Better user interface, faster response and a possibility for a large music database!
Don't remind me. :) I've been afraid to post these opinions on this thread, because some earlier posts have made it clear that they believe DIY should imply "only made by yourself." I wonder whether they even write their own compilers, assemblers, and CAD tools? Where do you draw the line, guys? Ah well... I guess I'm growing old. :)

I have no issues with guys who want to build from scratch (whatever their definition of scratch). It's just that we have different goals. My goal is to aim for a product whose performance is far superior to commercial products of comparable cost, and then figure out a way to reach there with as little cost and as little effort as possible. In my eyes, knowing how to save my effort is a sign of intelligence and maturity as an engineer. I may miss out on the learning that others get by scratch designs, but as I said, my goals are different.

And it's sure interesting to read what DJ, HBarske, and others are coming up with. I love uCs and uPs. Fascinating tech challenges and great little custom-built modules. Wish I had the time to do such work myself.

If we are willing to look at options without scratch design of hardware, unlike "real DIYers", then we can look at a PC-based approach, as you mentioned. Might cost a bit more in hardware than the current custom-built uC electronics, but will give better results with less effort, and will use any cheap CD-ROM drive. I'll write a separate post with a suggested architecture on that one.

A 120 Gb drive could store a large part of a CD collection, especially when compressed! (preferrably lossless of course!!!)
Yes. On an average, half-a-GB would hold a CD uncompressed, and quarter-GB would hold a lossless compressed CD.

I would like to find a cheap sound card solution that has a crystal with a convenient clock frequency to replace. It would be cool to have a sound card with an option for a clock input to synchronise with the DAC!!!
I guess you've checked out the M-Audio Audiophile 24/96 and the Digital Audio Carddeluxe? Not cheap (about USD 150 and 400 respectively), but excellent, I'm told. Of course, these cards will be overkill if all you want to build is a CD transport. You will need a card with just digital outputs and no DAC. There are much cheaper cards (USD 10-20?) like this, which can probably have their clocks modded.

Tarun
 
An alternate high-end CD transport based on CD-ROM drives

Hi all,

After Fedde's encouraging response, I thought I'd post a suggestion for an alternate approach to building a high-end CD transport using El Cheapo CD-ROM drives.

My objectives with this design:
  • Aim for high end performance, very accurate retrieval of data from CD, and very low jitter digital output
  • High re-use of off-the-shelf components, and minimise custom h/w and s/w
  • Use parts which should be easy to replace a few years down the line in case they fail. You should be able to use a different part even if you don't get an identical replacement.
  • Make it less expensive than, say, USD 400 for parts cost.
I can't build such a transport. :) But I believe that it can be done. I can only suggest the architecture for it, and see if there are any takers for it in this thread.

Hardware components of my proposed system:
  • An old (discarded) Intel Pentium motherboard with an Intel-compatible processor at 200MHz or faster. 64MB RAM. Select the processor such that a heatsink is adequate without a fan. Even 700MHz processors in current boards are available which work without fans.
  • Two inexpensive ATA CD-ROM drives, of any make or model.
  • A custom-built PCI plug-in sound card with digital output and a super-accurate clock
  • Custom-built PCB with LCD display and a few buttons, to provide the front panel
  • Custom-built chassis
  • IrDA port for remote control interfaces
  • keyboard, mouse and monitor not needed
The system will run on Linux and will work as follows:
  • The entire system software will reside on a bootable CD, which will boot from the first CD-ROM drive. (Anyone familiar with Knoppix here?) The software will be a hugely simplified, pruned-down and customised version of something like Knoppix, minus the weight of the graphical interface.
  • The user will then put in his audio CD in the second CD-ROM drive, and will use the front panel buttons to initiate play.
  • A modified version of CDParanoia will be fired, which will read audio data with all checks and corrections from the CD-ROM drive, and will pump this through a Unix pipe to another process (let's call it the output process) running in parallel, with a software-implemented buffer in between. This buffer will act as the readahead buffer and give CDParanoia time to do error-correction without interrupting playback.
  • The output process will keep reading data from the Unix pipe and pumping it out through the sound card. Simple.
Linux already has:
  • CDParanoia (which will need heavy modding to make it work in real time)
  • a stable multi-tasking kernel which, if pruned, can run on four-year-old Intel computers whose motherboards are available at throwaway prices
  • interface to sound cards
  • interface to IrDA interfaces and a lot of software which can allow a normal IR remote control to control it
  • easy extensibility to interface with custom hardware for, say, push buttons or LCD displays. All these can work through serial or parallel ports of the Intel motherboard.
There are many variations on this theme possible. But with this approach, it will be possible to use El Cheapo CD-ROM drives and still challenge really top-end CD transports. For those who want a one-box CD player, the DAC can also be incorporated into the box. (The easiest, though not the cheapest, way to do this is by plugging in an M-Audio Audiophile 2496 sound card.)

Those of you who like doing electronic design can have fun designing a top-end digital audio out card, and a lovely, user-friendly front panel. Once that is done, you can focus on building a super-low-noise PSU to replace the stock SMPS monster. (I feel a conventional transformer, diode bridge, and smoothing caps will deliver much quieter PSUs. And you can then eliminate the PSU fan.)

Waiting for responses. :)

Tarun
 
...and another...

I think this project should go standalone anyway. My plan is to use a PIC in conjunction with a CPLD. The pic will do the control and the CPLD will transform data from ATA interface into our lovely serial formats - I2S or Sony format - of course with reclocking/buffering. There is some work to do, but we have that Meridian to beat aren't we?
I started the research already so stay tuned. :nod:
 
I like tcpip's idea

if only because I already have an old AMD-150Mhz PC which I haven't decided how to dispose of yet.

Also I like the idea of turning all these throwaway pc's into sth useful.. I see about 1 a week go (on average) in this place..

This seems like a very low (hardware) cost solution. The cost here is probably high on time to implement.

I don't understand though, why a second cdrom is needed ? wouldn't a hd suffice ? Preferrably one that is turned off once the OS is loaded into memory ..?

my 2p's worth...

stelios
 
Throw out second CD-ROM drive

Thanks, Stelios.

stelios said:
if only because I already have an old AMD-150Mhz PC which I haven't decided how to dispose of yet.
Yes. This kind of computing power so cheaply available is almost disturbing, is it not? :) It seems almost illogical to custom-build a controller platform. I'd much rather take an old PC, replace the PSU with a better, quieter, perhaps non-SMPS one, and change the chassis.

I don't understand though, why a second cdrom is needed ? wouldn't a hd suffice ? Preferrably one that is turned off once the OS is loaded into memory ..?
I totally agree. My reasons to suggest a CD-ROM drive was to keep costs low, and to avoid problems in case my (old) BIOS does not allow powering down of the HDD. (In that case, the power consumption and heat dissipation issues would become more difficult.)

In fact, there's probably a better way to do it than both CD-ROM drive and HDD. Use a DOC. Nowadays, Disk-on-Chip cards are available which plug into your FDD connector, and appear to be a (large) floppy disk. (In my time, abouit four years ago, you could only use DOC with Linux if you had special motherboards with DOC sockets, IIRC.) I'd prefer the DOC to the second CD-ROM drive any day. Firmware upgrades too would become simpler that way; a DOC is read-write, unlike a CD. :)

On second thoughts, it might be possible to eliminate the second CD-ROM drive even without any DOC or HDD. One needs to tweak the Linux boot process a bit to ensure that it frees the CD-ROM once it boots up to ramdisk. I think this should be fairly easy. Once that is done, the same CD-ROM drive can be used for audio CD.

Tarun
 
Re: ...and another...

Lupulroz said:
I think this project should go standalone anyway. My plan is to use a PIC in conjunction with a CPLD.
I'll be following these developments very keenly. Since uC based design is relatively unfamiliar territory to me, I'll be very keen to see what works well and what difficulties you guys face. Best of luck. :)

Tarun
 
CompactFlash as boot device....

DJNUBZ said:
They have adaptors that make it so you can use a CF card as a HD. I am sure you could use that and only need one cdrom.
Yes, this too. But I guess nothing beats using the same CD-ROM drive for both bootup and audio CD playback, when it comes to low cost and hardware simplicity. ;) Haven't tried it yet, but should be possible. I would have loved to get rid of all moving parts, but can't get rid of that one CD-ROM drive. ;)

Tarun
 
Alternative PC Approach....

Konnichiwa,

I have just seen this little gem:

An externally hosted image should be here but it was not working when we last tested it.


http://www.jjmb.nl/content/content.php?Name=MSI-MEGA

Cost seems reasonably modest and are there not any PCI based Pro-Audio Digital interface cards that accept external clocking? Plus it will do the AV side just dandy. I'll probably get one....

Sayonara
 
Konnichiwa,

stelios said:
did you see it in Maplin ?

Yes, initally. But the unfriendly staff at the Tottenham Court Road shop almost turned me off it.

stelios said:
I didn't post it though as I doubt it will be easy to implement a memory buffer in this - or am I wrong ?

The "Memory Buffer" will be very easy, we have a whole ******** P4 PC with two Memory slots to nothing but that Job!!!! Actually, I'll probably just put the whole thing under windoze or linuX control with a basic Monchrome LCD Screen for display if advanced functions are needed.

The key, I need a Digital Interface Card that accepts an external clock. I know such exist for the studio market where you MUST be able to sync the whole studios various digital devices to an external clock sync source.

stelios said:

do you know the price ?

I have seen it on-line @ £ 200 + Vishously Added Tax for the "bare bone" system, meaning no CD-Drive, no CPU, no Memory and no HDD. I can probably get most if not all those items from dead computers at work for free....

Sayonara
 
Just saw this thread and this is exactly what I'm trying to do using the ITX computer approach.

I think that the key to succeed lies in the software, PSU and soundcard.

Using an ATAPI dvd (or cd) can't be all bad since Meridian uses just that in their Reference 800 dvd player.

For my project I've bought a 120VA 12V/5V toroid as the base for the PSU. I'm attaching a schematic over the PSU that I would like some feedback on.

More info on my project can be seen on my htpc page

Here's the schematic:
An externally hosted image should be here but it was not working when we last tested it.