#!/bin/bash
# version: 1.1
#
# (c) Kristian Peters 2002-2003
# released under the terms of GPL
#
# changes: 1.1 - syntax
#
# contact: <kristian@korseby.net>

if [ "${1}" == "-h" ] || [ "${1}" == "--help" ] ; then
	echo "${0} encodes all wav-files found to mp3."
	echo
	echo "Usage: ${0} [min bitrate] [max bitrate]"
	echo
	echo "audio files ending with *.wav must exist in the same directory"
	echo "from that ${0} was started from."
	echo
	echo "send bug-reports to <kristian@korseby.net>"
else
	echo
	if [ "${1}" == "" ] ; then
		for i in *.wav; do
			lame -k -h -v -b 192 -B 256 "${i}" "`basename "${i}" .wav`.mp3"
		done
	elif [ "${2}" == "" ] ; then
		for i in *.wav; do
			lame -k -h -v -b ${1} "${i}" "`basename "${i}" .wav`.mp3"
		done
	else
		for i in *.wav; do
			lame -k -h -v -b ${1} -B ${2} "${i}" "`basename "${i}" .wav`.mp3"
		done
	fi
fi


