Bulk CD Ripping — Part One: CDs to FLAC Images
This is going to be a multipart blog series on ripping CDs. I’ll start be describing the goals that lead me to this solution:
- Use a hardware changer to rip the CDs so that I don’t need to sit there and feed the computer each disk one at a time.
- Use ripping software which detects and corrects for errors during ripping caused by scratches or fingerprints on the CDs.
- Rip to a lossless format so that the files can be converted to any audio format at any point in the future.
- Each ripped disk should be represented by a single file (instead of a file per track) so that an exact copy of the CD can be burned in the future if that need arises.
- Use the most reliable tagging (metadata) database available so that the CDs end up with consistent and accuate titles.
Part one talks about the first four bullet points. Part two will expand on the last bullet point.
I had some vacation time to burn and rather than doing something useful like going on a long bike ride, remodeling the downstairs bathroom, or even reading a few novels I decided to rerip all of our music. Since I’m a software developer and not a CD changer I decided to buy new hardware and then write software to make it all work.
I ordered a Sony VGP-XL1B2 Media Changerfrom Amazon. This is a 200 disk CD/DVD changer designed for Windows Media Center machines. Itconnects to your computer via firewire (1394). The changer isn’t supposed to work under Windows XP and I didn’t want to use Media Center for ripping, but I figured that I could make it work anyway. What really convinced me was this blog post from Matt Goyerwhich described the interface that the changer’s driver must provide to Windows.
I ordered the changer and it arrived the next day (thanks to Amazon Prime’s $3.99 overnight shipping). When I plugged it into a Windows XP SP2 machine I was surprised to see it work without needing to install any drivers. A service called the Removable Storage Manager (RSM) detected it and seemed to start doing something with the CDs. I wasted about two hours playing with RSM before deciding that it was overly complicated for what I needed. So I decided to write my own tool to control the changer.
Using information from Matt Goyer’s blog post and MSDN I was able to write a small program called MediaChanger(the zip in that directory contains source and a debug binary). MediaChanger supports the following commands:
- MediaChanger mount
— This mounts the disk in slot into the drive. - MediaChanger unmount — This puts the currently mounted disk back to the slot that it came from.
- MediaChanger drivestatus — Reports if the drive is empty or full and where the disk came from.
- MediaChanger next — Unmounts the current disk and mounts the next one.
This provides enough changer support for a shell script to mount each disk one by one and do something with them. That provided the basis for ripping all of our disks.
Now the problem was automating my preferred ripper, Exact Audio Copy (EAC). EAC is the best audio ripper for CDs if you care about getting perfect rips with no errors. It is not always fast, but it always does a good job. It also supports ripping to a format called WAV+CUE which is a WAV file with all of the music and a text file called a CUEsheet that has the table of contents from the disk. We need WAV+CUE support to create FLAC images.
Sadly EAC is not designed to be scripted, which makes using it with my MediaChanger program a little difficult. A couple of friends pointed me to a script called REACT. REACT is written in a scripting language called AutoIt and adds features to EAC by watching dialog boxes and using menu items as a human would. This is a really ugly way to script something, but it is also the only option available for EAC. I modified REACT to add the following features:
- When finished ripping a diskswitch to the next one and start ripping (this is turned on by pressing Alt-F5). This is built on top of REACT’s existing feature of ripping an image by pressing F10.
- When EAC finds multiple hits for a CD in CDDB use the first one.
- If there is no CDDB information for a CD then title the CD after the slot that it came from.
I’m using REACT to generate FLAC images from the WAV+CUE ripped by EAC. This produces a single FLAC file which contains all of the data from the CD. In part two of this series I’ll explainhow Itag and convert my FLAC images into MP3 files.
With these changes REACT was ready for bulk CD ripping from the changer. I loaded up the changer with a drawer full of CDs from our CD cabinet and let it run. The drive in the changer is not very fast at audio extraction, so it takes about 24 hours for it to rip 200 CDs. This is a little longer than I hoped for it, but at least I don’t have to sit there while it runs.
I have been working to get thsi setup working. I have trouble after the first disk rips. The changer appears to change to the next disk which I have verified. However, the title in EAC never changes when I am running REACT. I tried lengthening the sleep time prior to changing into the cddb state within your react script. Still no joy. EAC does not change the title while REACT has control.
However, if I use media changer to unmount the disk, then mount another disk when I have killed all of the dialogs from the run initiated by pressing F5, then EAC / REACT detects the disk insertion after about 15 seconds and all is cool.
WHat do you think is wrong?
Kurt
Geez, I also purchsed the sony thinking i could get it to work. I only know vb.net so your sample mediachanger makes no sense to me… Is there a way to convert it to a dll that my vb.net app can call? or a simple vb.net app? i have been trying to find something for almost a year. no one has samples for this. this is the best that i have found.
Looking through your mediaChanger code, i have a question. how do you do an printf of the serialnumber? I do printf(“serial = “, changerProductData.SerialNumber); and it always blank.
The changer doesn”t actually read the CDs by default, it just scans them. I”d recommend mounting the CD and then reading the serial number using normal means.
I was trying to find the serial number of the sony Changer, not the discs. By the way, thanks for this great post. It has alot of information for me to get started.
Alex …
Can you post an example of the shell script that you used to get this all working. Shell scripting is new to me and it would be nice have an example. Thanks for your help.
The entry immediately following this one includes links to all of the scripts that I wrote.
I have read through all of your scripts. I still cannot figure our how you are “using a shell script to mount a disc”. The ini file contains a reference to mediachanger … are you somehow mounting and changing disks through the autoit script? I can get my changer to advance / mount / unmount using a simple command prompt. I cannot figure out how to automate this. Are you just using React, or are you using another script to mount the disc … running react … then mounting the next disk, etc.
Thanks for your help
I am using a modified version of react with autoit. The version of react is linked into this post — http://www.phred.org/~alex/transcode/REACT/REACT2.zip
I”d recommend testing your setup first with the normal react to make sure that you are happy with the rips. My version works the same way with the exceptions listed in the entry.
Alex … I am so close now. I got the react script to work … the first cd rips … the changer loads the next cd … but eac does not update the free dbdata for the new cd … the directory / file name for the new cd does noty change either. This seems like the same problem the Kurt had above. Any ideas ? What version of EAC were you using? Could that have something to do with it? I am using 0.95 beta 4.
Thanks for your help. -J
I was using 0.95 beta 4.
Do you have EAC configured to look up a CD on insert? If this isn”t working without my version of react then I don”t think it will work with it.
I accidentally deleted a comment where someone said that they had ripped everything but the cue sheet wasn”t properly embedded into the FLAC.
If you still have this than you can write a simple shell script which runs over your FLAC files and embeds the cue by running:
metaflac –import-cuesheet-from=file.cue –tag-from-file=”cuesheet=file.cue”
This will set both forms of the cuesheet into the file. Check your react-image.cfg to make sure that it is automatically done in the future.
alex
Alex … I also have the same problem. My discs rip fine, but I get a flac and a cue for each album. The cue does not contain any metadata except for song start / stop etc. There are no song titles in the external cue, and react does not seem to embed the cue in the flac file. Because of this, your Tag script does not work. Where and how (exactly) do I need to modify my react-image.cfg to get this working. Or better yet, can you post a correctly modified react-image.cfg. Thanks so much.
Alex … What Gap detection Method did you use for this drive. I have tried method B, Secure and accurate, but it takes a really long time. Also is there some sort of offset that needs to be set in EAC for the Matshita drive ? Thanks for your help.
Sorry, I don”t remember which gap detection method or offset I used with the drive. I sold my changer after the big rip and don”t have the machine that was configured to use it anymore. I did some experimentation with known CDs and critical listening of them before ripping everything in bulk.
The drive is not fast. At best I got 5x rips out of it. The gap detection wasn”t too slow however.
Alex … Now that music brainz allows you to directly enter its server in EACs CDDB server box, EAC is able to directly obtain information from musicbrainz during the ripping process … Knowing this, is there any reason to use the tag app ?? Or can this all be done during the bulk rip with your script. Also, how did you handle cover art?
Picking the right musicbrainz entry in EAC isn”t ideal. There could be multiple hits, and having to select them would slow down the bulk ripping. Pointing it to the musicbrainz CDDB server should make running the tagger go a lot faster, especially if you can make EAC write out the musicbrainzid tag.
coverart is tricky. I was going to incorporate that into the tagger, but couldn”t find a UI library for Python that was cross platform and made it reasonably easy. So far I”ve used other cover art taggers only on my MP3 collection.
Have you looked at using the changer to burn 200 copies of a CD or DVD?
Mass duplication (original material) might pay for the changer.
The mediachanger software is great. Does it provide any kind of feedback to an action, such as whether a slot was mounted successfully?
Hello,
I am new to this and have no scripting/programing knowledge (although I can get around in Linux and have written a .bat script here and there for MentalRay renders). I have attempted to use the GUI created by MediaDogg (avsforum) and have attempted to contact him with questions/problems I am having. At this point I have had no success, so I figured I”d go back to the source.
…however in looking at your orginal post here I still have no idea how to get REACT to work with the ”raw” MediaChanger files (as downloaded from above).
It seems given my lack of ability/experience that I may be too much of a ”hard-case” to receive assistance, but assistance of any kind would be greatly appreciated.
Many Thanks,
Brett
brettra2@yahoo.com
So far I have completed the following (I think):
1) I have downloaded and properly installed REACT, EAC, MediaChanger and AutoItv3 (I am pretty certain of all of this, directories seem correct, MediaChanger seems to control the changer)
2) I have edited REACT’’s ”REACT.ini” and the ”REACT-image.cfg” to make sure paths and settings are as desired
3) Read about 50 pages of posts today on all of the aforementioned.
Questions are as follows:
1) Installed as a part of REACT 2.0 are the following files: ”react.cmd”, ”make.bat”, ”play.au3” and ”REACT.au3”. I have attempted to use autoit to run the .au3′’s, but with no luck and the .bat and .cmd files open dos shells full of errors (later if you”d like I can send them).
2) Do I need to use MediaChanger to mount a disc before I begin?
3) What am I missing here to begin the automated ripping? If I use autoItv3 to execute the ”REACT.au3” EAC comes up but that’’s it?
4) REACT 2.0 has no instructions for install, I fear my mistake may be here….? Right now all directories are separate and under c:changer and the paths inside the REACT.ini have been changed to reflect the current path to MediaChanger.exe
c:changer>REACT2>REACT.exe
c:changer>EAC>EAC.exe
c:changer>GUI-055>temp>MediaChanger.exe
5) Can you suggest ‘’stable versions” of the software you used? There have been many changes I fear since you did what you did.
Once again…any help would be greatly appreciated.
Thanks,
Brett
brettra2@yahoo.com
Again I apologize for the intrusion
It sounds like you are using the wrong REACT. I made changes to REACT to make it work with the MediaChanger. You need the version at
http://www.phred.org/~alex/transcode/REACT/REACT2.zip
Hey Alex,
Thank you very much for getting back to me. Please excuse me and my questions for I feel like I am on some sort of Digital Archaeologists journey here, digging back through time but not in a linear fashion.
I did previously download your mods to REACT2, but have been confused by so many posts in so many forums…for example (and as brief as possible):
1) Can you verify the installation instructions for your mod of react? Are they the same as those mentioned here: http://www.hydrogenaudio.org/forums/index.php?showtopic=35158
2) This post says REACT will not work with EAC .99 and gives no instructions for installing 2.0: http://www.hydrogenaudio.org/forums/index.php?showtopic=50259
3) In your mod, is there a reason why the ”REACT.au3”, ”REACT.ico” and make.bat are under the main dir?
4) I am assuming that if I install your version of REACT2.0 correctly I will be in good shape…I understand enough (to test at least) the REACT.ini and .cfg’’s but to tell you the truth I have no idea how to initiate the batch rip. Do I need autoit or is there a .bat I need to create and run…?
Again, thank you very much for getting back to me. I really appreciate it.
Best,
Brett
Hi Again Alex,
Can you tell me why you have the REACT.ini set up to look for everything at ”c:changer”. I take it this is where I have to install EAC (instead of Exact Audio Copy) and MediaChanger? Or can I just change the REACT.ini? Did you do this to remove spaces in names and paths?
thanks!
b
Please send me an email if you would.
Many Thanks,
brett
Can MediaChanger be used to control more than one changer connected to a single machine?
Sorry, I don”t remember. I wrote this stuff years ago and haven”t done anything with it since then.