How to quickly convert WAV to MP3

The easiest way to convert a bunch of WAV files in a folder to MP3 is a script; paste this code on bash prompt when you are in the correct folder.

#!/bin/bash

SAVEIF=$IFS
IFS=$(echo -en "\n\b")

for file in $(ls *wav)
do
  name=${file%%.wav}
  lame -V0 -h -b 160 --vbr-new $name.wav $name.mp3
done

IFS=$SAVEIFS

If you are asking for $IFS: http://www.cyberciti.biz/tips/handling-filenames-with-spaces-in-bash.html

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s