Converting WMA files to MP3

I recently needed to convert a bunch of WMA files to MP3 on my macbook. The easiest way to do it was to open up a terminal window, change directory to the directory with the files, and then use mplayer to convert each file to a WAV, and then sox to convert the file to an MP3. The command line I used is described below:

  1.  
  2. for i in *.wma ; do
  3. MN=`basename "$i" .wma`.mp3
  4. mplayer -vo null -vc null -af resample=44100 -ao pcm:waveheader "$i"
  5. sox audiodump.wav "${MN}"
  6. rm audiodump.wav
  7. done
  8.  

I probably can just output straight to MP3 from mplayer, but I couldn’t be bothered reading through the mplayer man page to work out how to do it!