Skip to content

Instantly share code, notes, and snippets.

@warthurton
Created January 21, 2011 03:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save warthurton/789192 to your computer and use it in GitHub Desktop.
Save warthurton/789192 to your computer and use it in GitHub Desktop.
#!/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