• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2#
3# auenc -- version 0.1
4#
5# A wrapper for lame to encode multiple files.  By default, a .wav
6# extension is removed and replaced by .mp3 .
7#
8# (C) 1999 Gerhard Wesp <gwesp@cosy.sbg.ac.at> under the GPL.
9
10# set the variables below according to your taste
11LAME=lame
12LAME_OPTS="-S -h -v -V 0 -b 256" # high quality, silent operation
13
14if [ $# -lt 1 ] ; then
15  exec 1>&2
16  cat << _EOF_
17usage: $0 [options] file...
18options:
19  -d --delete: delete original file after successful encoding
20_EOF_
21  exit 1
22fi
23
24unset DELETE
25case "$1" in
26  -d | --delete ) DELETE=1 ; shift ;;
27esac
28
29for f
30do
31  $LAME $LAME_OPTS "$f" `basename "$f" .wav`.mp3 || {
32    exec 1>&2
33    echo "encoding of $f failed, aborting..."
34    exit 1
35  }
36  if [ -n "$DELETE" ] ; then
37    rm -f "$f"
38  fi
39done
40