--- /dev/null
+#!/usr/bin/env bash
+
+die() {
+ echo $@
+ exit 1
+}
+
+usage() {
+ cat <<EOF
+create_sid_mp3: creates mp3 out of sid files
+
+-h This help message
+-i [infile] Set input SID
+-o [outdir] Set output directory
+EOF
+}
+
+input=""
+outdir=""
+while getopts "hi:o:" flag; do
+ case $flag in
+ i) input=$OPTARG;;
+ o) outdir=$OPTARG;;
+ h) usage; exit 0;;
+ *) usage; exit 1;;
+ esac
+done
+shift $((OPTIND-1))
+[ "${input}" == "" ] && die "you must supply a sid file to convert with -i"
+[ -f "${input}" ] || die "can't find ${input} (or is not file)"
+[ "${outdir}" == "" ] && die "you must supply an outdir direcctory with -o"
+[ -d "${outdir}" ] || die "can't find directory ${outdir} (or is not dir)"
+base="`basename "$input"`"
+wav="${outdir}/$base.wav"
+sidplayer "${input}" --outfile "${wav}" --time 300
+mp3="${outdir}/$base.mp3"
+lame -q 2 -b 123 "$wav" "$mp3" || die "lame failed"
+rm -f "${wav}"