Created
January 21, 2011 03:19
-
-
Save warthurton/789192 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
inputfile=$1 | |
outfile=$2 | |
temp1=$$.wav | |
exitcode=0 | |
if [ ${inputfile: -4} == ".mp3" ] | |
then | |
lame -S --decode $inputfile $temp1 | |
else | |
temp1=$inputfile | |
fi | |
sox -q $temp1 $temp1 -n trim 0 00:05 silence 1 5 2% | |
if [ $? -eq 0 ] | |
then | |
exitcode=1 | |
fi | |
lame -S --resample 11.025 -b 8 -a $temp1 $outfile | |
if [ $? -eq 0 ] | |
then | |
exitcode=1 | |
fi | |
if [ -f $inputfile ] | |
then | |
rm $inputfile | |
fi | |
if [ -f $temp1 ] | |
then | |
rm $temp1 | |
fi | |
exit $exitcode |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment