Sunday, April 13, 2008

Hack the Ripper

I don't usually rip audio CDs, but when I do, it's usually for my wife. The optical drive on my laptop is busted, so until recently, I used to rip CDs on her Window$ laptop. It's rather easy. Windows Media Player even lets you listen to the music while it's being ripped to a bunch of MP3 files.

But now that I have an external optical drive, I figured I could do the same on my Linux box. GNOME provides Sound Juicer as the default application for playing and ripping audio CDs. Like many other GNOME applications it looks clean and simple, almost too simple. GNOME applications often leave me wondering if they can actually do the job they're meant to perform...

So I gave Sound Juicer a try - and was soon surprised to find out that it didn't offer any way to convert the audio tracks to MP3. I selected Edit->Preferences from the menu, and opened the drop-down list of output formats - nada.

I pressed the adjacent "Edit Profiles..." button and got a dialog box showing all the available profiles. Hey - there's an MP3 profile here! I happily selected it, pressed "Edit", expecting a dialog box with some MP3 related options. Well, I did get a dialog box - it allowed me to modify the name of the profile, its description and a meaningless "GStreamer pipeline" text box. Sound Juicer started to look suspiciously like a command-line junkie's GUI programming exercise...

I hit the "Close" button, but the drop down list didn't show any MP3 profile. This looked like a genuine bug, and I went over to the Debian BTS to verify. Sure 'nuff there's mention of some profile related problems, but these all seem quite old, and not directly related to my problem.

This seemed too obvious a problem to have gone unnoticed, so I decided to search around the Net for any clue, under the assumption that I may be missing something obvious. I hit upon this blog entry, where I learned that I needed to install the (non-Debian) GStreamer lame plugin:
aptitude install gstreamer0.10-lame
This fixed my problem, letting me select MP3 as the output format.

I also learned that what looked like bad GUI programming on the side of the Sound Juicer author, was actually good GNOME programming - he used a standard GNOME dialog box to edit the audio profile, which can be launched separately using gnome-audio-profiles-properties. It's just that this dialog box is rather cryptic, to anyone who's clueless about the inner workings of GStreamer.

The next problem to tackle was how to make Sound Juicer encode the MP3 files at a bit-rate of 192K bps instead of the default 128K bps ? Here's how:
  1. open the audio profiles properties dialog box from within Sound Juicer using "Edit->Preferences->Edit Profiles..." or by running gnome-audio-profiles-properties
  2. select the MP3 audio profile, press "Edit"
  3. add bitrate=192 to the lame stage of the pipeline, like this:
    audio/x-raw-int,rate=44100,channels=2 ! lame name=enc mode=0 vbr-quality=6 bitrate=192 ! id3v2mux
  4. press "Close" and you're done.
You can control other aspects of the encoding process with other options. You can discover which options are available with the following command:

gst-inspect lame

3 comments:

  1. why do you torture yourself? since leaving mobileye ive run through too many systems and have just decided that because they are all crap i have to have one of each. makes sense no? beh, off topic i guess but just wanted to say hello. was nice to find your blog. catchya in the near future -- Nathan

    ReplyDelete
  2. Multiplying the amount of crap to deal with does not sound like a sane policy ;-) Looking forward to meeting you again. Have fun.

    ReplyDelete
  3. I use grip to grab into flac.
    It required some tinkering (I specified flac command line) tho.

    ReplyDelete