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

10.4: A CD ripping workflow System 10.4
I needed to produce MP3s from CDs with a 30-second preview. After testing several commercial solutions, I found that none suited our needs easily. At that point, I began searching for an open source project that could be utilized from a script. Ultimately, I came up with the following: LAME, SoX and Automator on OS 10.4.8 with Xcode version 2.2.1.

LAME is a open source MP3 encoding library utilized by many applications. I used the latest version, v3.97 available from their site. The build did not require any modifications to the source code:
$ cd /path/to/lame-3.97
$ ./configure
$ make
$ sudo make install
The installation of lame is required before building SoX. The default installation will place files in /usr/local.

SoX is a utility for sound file conversion for a variety of formats. By installing LAME first, it enables SoX to directly encode to MP3 from the CD. I used the latest version, v13.0.0 available from their site. The SoX build also did not require any modifications to the source code:
$ cd /path/to/sox-13.0.0
$ ./configure
$ make
$ sudo make install
The default installation will place files in /usr/local.

Automator is a tool for creating workflows on the Mac OS, new to OS 10.4. Although the following can be replicated in AppleScript, I have opted to use Automator at this time for simplicity. The first step in the workflow is to choose the Finder category and then Ask for Finder Items. Specify Folders as the type.

Next, use the Finder's Get Folder Contents to list all of the items in that folder. This assumes that the user has selected a CD and there will only be audio files. I'm certain that better error checking would be a nice addition, however, this would require a bit of AppleScript to filter.

The last step is to add the Automator: Run Shell Script action. This is where the bulk of the work is done. I used the following script:
path=~/Desktop/MP3Output
preview="$path"/preview
full="$path"/full
if [ ! -d "$path" ]; then
  mkdir "$path"
fi
if [ ! -d "$preview" ]; then
  mkdir "$preview"
fi
if [ ! -d "$full" ]; then
  mkdir "$full"
fi
	
for f in "$@"
do
  fullout="$full"/`basename "$f" .aiff`.mp3
  previewout="$preview"/`basename "$f" .aiff`.mp3
  /usr/local/bin/sox "$f" "$fullout"
  /usr/local/bin/sox "$f" "$previewout" trim 0 00:00:30.0 fade p 0 27 3
done
The above simply creates a directory to place the MP3s. The full MP3s are processed first. The previews are processed by triming the file down to 30 Seconds for the preview. A three-second parabolic fade is applied, and the resulting file is encoded as an MP3.

[robg adds: I haven't tested this one.]
    •    
  • Currently 2.80 / 5
  You rated: 5 / 5 (5 votes cast)
 
[11,391 views]  

10.4: A CD ripping workflow | 1 comments | Create New Account
Click here to return to the '10.4: A CD ripping workflow' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: A CD ripping workflow
Authored by: rjbailey on Mar 05, '07 12:00:08PM
Great hint. Both LAME and SOX are most easily installed as part of Fink.
sudo fink install lame sox

[ Reply to This | # ]