#!/bin/bash -f
#
# PODNAME: festivalmp3
# ABSTRACT: script converting textfile named $1
#                               into mp3file $2
#                                 with voice $3
#           using festival

# Check arguments
if [ "$#" -ne 3 ]; then
    echo "Usage: $0 <input_text_file> <output_mp3_file> <voice>"
    exit 1
fi

# Settings
VOICE=${1:-us1_mbrola}          # check which voices exist using:
                                # $ festival
                                # festival> (voice.list)
                                # (quit)

# Start the feast!
text2wave -eval "(voice_$VOICE)" -o $2.wav $1
lame $2.wav $2
/bin/rm $2.wav
