#!/bin/bash
#
# wav to mp3
# This is not a script of my creation, I just added some things
# Tell me if you are the real author of this script
# Yoda-BZH tristan AT kerguz DOT fr
IFS="
"
function wav2mp3 () {
if [ ! -f "$1" ]; then
echo "File $1 not found!"
else
if [ -f "${1%%.[Ww][Aa][Vv]}.mp3" ]
then
echo "File ${1%%.[Ww][Aa][Vv]}.mp3 already exists, skipping"
return
fi
#wav=`ls "$1" | tr -d "*"`
mplayer -ao pcm "${1%%.[Ww][Aa][Vv]}.wav" "$1" &&
#mv audiodump.wav "$wav" &&
#unset wav &&
lame -h -b 160 "audiodump.wav" "${1%%.[Ww][Aa][Vv]}.mp3"
rm -vf "audiodump.wav" ||
#&&
#rm -f "$1" ||
echo "There was a problem with the conversion process!"
fi
}
# convert all wma files in directory
if [ $# -eq 1 -a -d "$1" ]; then
for file in $1/*.[Ww][Aa][Vv]; do
wav2mp3 "$file"
done
exit
fi
# One or more wma files were given
for file in $*; do
wav2mp3 "$file"
done
# Not enough information
if [ $# -lt 1 ]; then
echo
echo "Usage: wav2mp3 myfile.wav"
echo " wav2mp3 /directory/containing/wma/files"
echo " wav2mp3 myfile.wav myfile2.wav myfile3.wav"
# You have to use quotations for the arguement below.
# Failure to do so will result in only one file being
# converted. Namely, the first one it comes across...
echo ' wav2mp3 "*.wav"'
echo
echo "For converting .wma's that have spaces in the"
echo 'name, use the directory option OR "*.wav"'
echo
exit
fi
exitwav2mp3 shell script
Here is a small shell script ton convert .wma files to .mp3 files