#!/usr/local/bin/bash
# AAC to MP3 Convertor
# REQUIRES: mplayer, lame 
arg1="$1";
if [ $arg1 ] && [ -d $arg1 ]; then 
for i in $arg1/*.aac; do
i_new="$(echo $i|sed -e "s#\.aac#.wav#")";
i_new1="$(echo $i|sed -e "s#\.aac#.mp3#")";
echo -e "Converting\n\n\t |$i|\n\t to |$i_new|";
mplayer -really-quiet -ao pcm "$i" -ao pcm:file="$i_new" >/dev/null 2>&1; 
lame "$i_new" -o "$i_new1";
done
else 
echo "Type location to the directory containing AAC files";
exit 1;
fi 
