Monday, September 18, 2006

FAAD2 for OSX

This started as a simple task. I wanted to convert some cassette tapes into MP3 files. I have a shiny new iMac that I thought would be perfect for the task. Then I ran into lots of problems.

I used GarageBand to record the audio. I thought I could simply save it as an MP3 file but that would be too simple, wouldn't it? GarageBand only creates AAC encoded audio in M4A files. Unbelievable! Eventually I got a solution.



I read some tips about exporting the M4A to iTunes and then using iTunes to create MP3 files. That seemed cumbersome. I decided to used FAAD2 to convert the M4A file into a WAV file. Then I could re-encode the WAV to MP3 using LAME.

I didn't have LAME or FAAD2 yet, but luckily, I'd already gone through the pain of installing DarwinPorts for OSX. A simple 'sudo port install lame' had no trouble installing LAME. However, sudo port install faad2 failed with some kind of error about 'lrintf already defined'. A bit more research lead me to edit /usr/include/architecture/i386/math.h. I found extern long int lrint ( double ); and extern long int lrintf ( float ); on lines 377 and 378. I commented out those lines (put // in front of them) and tried installing FAAD2 again.

DarwinPorts got into some kind of funky mode where the Mac thought FAAD was installed even though it wasn't. Everytime I tried sudo port install faad2 it just kept ending with cleaning faad2. I went several rounds trying to uninstall FAAD. I didn't keep careful notes (sorry) but eventually I coerced DarwinPorts to re-install FAAD.

With FAAD and LAME properly installed, I went back to GarageBand. I changed the settings to export 192 kbps AAC files and selected Export Podcast to Disk (I started with a Podcast project since I was converting a lecture). I figured the 192 kbps file would be sufficiently high enough quality to survive re-encoding.

This is what I ended up doing:


  • GarageBand export to file.m4a

  • faad file.m4a -o file.wav

  • lame -a --preset voice file.wav file.mp3



References:

http://darwinports.opendarwin.org/docs/ch01s04.html

http://trac.macosforge.org/projects/macports/ticket/8858

2 comments:

  1. Yikes! I did the same thing a while back for a few of my cassette tapes, and it was A LOT easier than that! I used my good old Archos Jukebox Recorder. I just hooked it up to the cassette player, hit play on the cassette player, hit record on the Archos (puts it in mp3 format), then hooked up the Archos to my Linux computer with USB (works with ANY OS without any special software since it uses the USB Mass Storage Device protocol), and copied the files to my computer. My Archos may be pretty old and look like a tank compared to the "modern" mp3 players, but it does EVERYTHING I want it do do, unlke most if not all modern players that impose artificial, ridiculous restrictions on what you can and cannot do (for example, this M$ Zune player you talk about, I wouldn't touch that thing with a 10 foot pole!)

    ReplyDelete
  2. Well, if I was willing to accept AAC as the final format, I would have been done at step one. The Mac comes with Garage Band which had no trouble recording the audio input and saving an M4A file that iTunes and iPods will play just fine. I'm just extremely disappointed that Garage Band can't create MP3 files. I know Apple wants to promote their own format, but ignoring MP3 completely just makes Garage Band about useless.

    ReplyDelete