Linux: Convert WAV to MP3

By nick | Uncategorized
21 Jun 2011

Depending on your operating system you’ll use different ways to install the audio conversion software shown below.

Debian:  apt-get install lame

Ubuntu: apt-get install lame

Freebsd: cd /usr/ports/audio/lame; make install clean

Once lame is installed, the script below can be downloaded and placed in a bin directory (or any other suitable place).

#!/bin/bash
#
# wav2mp3
#
for i in *.wav; do
#out=$(ls $i | sed -e ‘s/.wav//g’)
#out=$(echo $i | sed -e ‘s/.wav$//’)
#lame -h -b 192 “$i” “$out.mp3″
lame -h -b 192 “$i” “${i%.wav}.mp3″
done

Don’t forget to chmod +x !

Leave a Reply