Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Extract raw CD audio data UNIX
I recently wanted to extract the audio from an entire CD as a single gapless track, even though the CD itself has multiple tracks. Yes, iTunes already has a feature to do this; the following hint is for the power users among us and has other uses as well.

It turns out the .aiff files from mounted audio CDs are nicely formatted -- they essentially wrap the 2352-byte block Red Book CD audio with a 2352-byte AIFF header. For some reason the audio samples are little-endian, but our UNIX friend dd is up to the task:
  dd bs=2352 skip=1 conv=swab </Volumes/CD/1.aiff >out.raw
To rip the whole CD into a single file, I used this:
  cd /Volumes/CD
  for file in *.aiff; do dd bs=2352 skip=1 conv=swab 
   <$file; done >/tmp/out.raw
NOTE: The last two lines are one long line. Alternatively, pipe the output directly to another sound processor (encoder, sox, whatever); the output format is raw 16-bit big-endian stereo interleaved samples at 44.1 kHz.
    •    
  • Currently 3.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[10,365 views]  

Extract raw CD audio data | 14 comments | Create New Account
Click here to return to the 'Extract raw CD audio data' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Extract raw CD audio data
Authored by: rkchang on Jun 09, '04 12:18:27PM

Is there a way to extract raw audio in WAV or AIFF form and also automatically generate CUE sheets for track markings? So far, this is the only thing I thing I feel I need my Windows machine for (a la Exact Audio Copy, EAC). I frequently archive and copy live recordings, and so far EAC has been the best option for me. I've been anxiously awaiting an OS X equivalent.

---
"I have seen the evils of procrastination, and I vow to change my ways tomorrow."



[ Reply to This | # ]
Extract raw CD audio data
Authored by: Greedo on Jun 09, '04 03:08:00PM

You can use mp3splt (installed via Fink) to do splitting of MP3 or OGG files. I don't know about AIFF though.



[ Reply to This | # ]
Extract raw CD audio data
Authored by: rkchang on Jun 09, '04 09:51:57PM

A lot of the audiophiles that I regularly trade live recordings with can notice degradation in sound quality in MP3 and OGG files (I have to admit, I can also slightly detect the quality difference between genuine CD-audio and MP3's), so I'd like to avoid use of those files. One nice thing with EAC is that it can automatically rip one continuous high quality WAV with track markings (via CUE sheet), thus ensuring no blips between tracks, then burn them to CDR.

I also have to admit that I'm not too skilled with constructing scripts, so if anyone knows how to construct a scipt for this use, I'd very much appreciate it.

---
"I have seen the evils of procrastination, and I vow to change my ways tomorrow."



[ Reply to This | # ]
Extract raw CD audio data
Authored by: verement on Jun 09, '04 06:19:42PM

Although I'm not aware of an existing tool to do so, I think it would be very easy to construct a .cue file from the information found in the property list provided on the mounted CD (.TOC.plist).



[ Reply to This | # ]
Extract raw CD audio data
Authored by: gommino_2000 on Jun 10, '04 09:30:44AM

Toast will extract the audio to an aiff, complete with track markings and titles with no gaps between the tracks. Just do "Copy" and then choose "Save as Disc Image" from the file menu.

Rob.



[ Reply to This | # ]
Extract raw CD audio data
Authored by: ChrisR on Jun 10, '04 09:53:07AM

See this hint and for some guidance on extracting toc info. (You might want to take a look at my script in the comments as well.)

Chris

[ Reply to This | # ]

Extract raw CD audio data
Authored by: veneman on Jun 09, '04 05:40:14PM

I have a few CDs with audio before the first track, which you can only hear if you rewind from the beginning of the CD (does this make sense? :)
Does anyone have a clue how i can rip these "secret" tracks?



[ Reply to This | # ]
cdda2wav
Authored by: Auricle on Jun 09, '04 05:57:33PM

I don't know of a GUI utility for MacOS which will do this directly, but cdda2wav (installed via Fink) should output the necessary data which could be reformatted via a script into CUE format.

For extracting the PCM audio into separate tracks with WAV headers:

cdda2wav -paranoia --cddb=0 -B -O wav dev=IODVDServices
This will create an info file for each track and two files for the entire disk. If you're handy with scripting, you could create a CUE sheet from this data.

cdda2wav is great for making sure you're getting the bits off the disc correctly.



[ Reply to This | # ]
cdda2wav
Authored by: Auricle on Jun 09, '04 06:00:52PM

Clicked the wrong reply link... this was a response to the query about CUE sheets, not the OP. Sorry...



[ Reply to This | # ]
Easy WAVE + .cue generation
Authored by: p0p5tar on Jun 10, '04 08:21:39PM

I have found the easiest way to generate a WAVE and .cue is to use 2 tools:

MissingMediaBurner (http://www.versiontracker.com/dyn/moreinfo/macosx/16799)
and
cue2toc
(http://cue2toc.sourceforge.net/)

Using MMB you can output a WAVE and TOC file, with the added advantage that you can use cdparanoia to rip the cd (very similar to using EAC on Windows) allowing copies of cd's that will play better than the original (if the original is scratched)

Cue2toc will then convert the TOC to the more familiar windows .cue format. (It does come as source but compiles easily on OSX)

NB cue2toc is also usefull for when friends give you a mp3+.cue file to burn, as it allows you to generate a TOC file that can be used to burn the mp3 (converted to WAVE) in MissingMediaBurner



[ Reply to This | # ]
Easy WAVE + .cue generation
Authored by: rkchang on Jun 10, '04 08:56:01PM

how do you configure MMB to use cdparanoia as its extraction method?

---
"I have seen the evils of procrastination, and I vow to change my ways tomorrow."



[ Reply to This | # ]
Easy WAVE + .cue generation
Authored by: p0p5tar on Jun 11, '04 08:35:58AM

I have actually been using an earlier version of MMB which included this in the options. It is still possible to do, by editing the commands sent to cdrdao (by use of the show command option) but it might be easier for you to use this other application instead:

Firestarter FX ( http://www.projectomega.org/subcat.php?lg=en&php=products_firestarter )

This app is also built around the cdrdao app and as such includes the cdparanoia function (is in the advanced prefs of copy cd)
This will output a toc+bin file...just rename the bin to wave.

If you know what you are doing i would recommend that you might find it easier to download two apps "on my command" and "on my command edit" and setup contextual commands linked to the cdrdao binary (which is easy to extract and place in /usr/local/bin if you only want the binary).
I have found it very useful to just have a contextual menu as i only use a couple of the functions of MMB..eg for burning backup svcds



[ Reply to This | # ]
Easy WAVE + .cue generation
Authored by: p0p5tar on Jun 11, '04 09:13:54AM

http://www.angelfire.com/mac/rnc/MissingMediaBurner0.4.1.sit

is the link if you want the earlier MissingMediaBurner that is very simple but does allow paranoia ripping with cddb lookup

if anyone would be so inclined, and has the skills, it would be nice for a droplet to be made that would allow you to drop a cd onto and automatically rip and convert to cue+wave files (using the cdrdao and cue2toc cli apps)



[ Reply to This | # ]
WAVs and CUE sheets
Authored by: rkchang on Jun 10, '04 08:33:01PM

So many helpful hints! Thanks to everyone!

---
"I have seen the evils of procrastination, and I vow to change my ways tomorrow."



[ Reply to This | # ]