#!/bin/sh
voice=$1
shift
if test -z "$voice" ; then
        echo "*** no voice library used" ; exit -1 ; fi
if test -z "$*" ; then
        echo "*** no codecs specified" ; exit -1 ; fi
if test ! -d "$voice" ; then
        echo "$voice: invalid or missing" ; exit -1 ; fi  
for codec in $* ; do
        encoding=""  
        ext=""         
        case "$codec" in
        al*)
                ext="al"
                encoding="-encoding=alaw"
                ;;
        ul*)
                ;; 
        *)
                encoding="-encoding=$codec"
                ext="$codec"
                ;;
        esac
        if test ! -z "$ext" ; then
                for file in $voice/*.au ; do
                        file=`echo $file | sed -e "s/[.]au$//"`
                        audiotool -build $encoding $file.$ext $file.au
			chmod o+r $file.$ext
                done
        fi
done
exit 0                

