I'm sure there is something out there that does this already but I make a lot of CDs and because of this a needed a very quick method for batch converting .mp3 files to .wavs, to be burned to CDR.
This script will loop through all the files in the folder you specify and convert them from .mp3 to .wav
copy the following code and save it in a file mp32wav.sh
Code:
#!/bin/bash
#Script: mp32wav script (requires mpg123 package)
#Purpose: Loops through a path and convert all the mp3s to wavs
#
#usage: mp32wav [Path]
count=0
Convert(){
mpg123 -b 10000 -s "$x" | sox -t raw -r 44100 -s -w -c2 - "`sed s/mp3/wav/ sedEdit`"
}
syntax_error(){
clear
echo "Mp32Wav - Convert Mp3 Files To Wav Files"
echo "script syntax: mp32Wav <path>"
echo ""
exit 0
}
if [ -n "$1" ]; then
cd "$1"
for x in *.mp3
do
let "count += 1"
echo "$x" > sedEdit
Convert
done
else
syntax_error
fi
echo "$count mp3s found and converted to wavs... [Baileysoft 2005]"
rm sedEdit
exit 0
1. install mpg123
Code:
sudo apt-get -y install mpg123
2. make the file executable
Code:
chmod +x mp32wav.sh
3. copy to /usr/bin
Code:
sudo cp mp32wav.sh /usr/bin/mp32wav
Usage:
mp32wav <path>
example: mp32wav /tmp/mp3
Converts all the mp3s in /tmp/mp3 to wavs
example: mp32wav `pwd`
converts all mp3s in your current directory to wavs
Bookmarks