#!/bin/sh

TRAINfiles=$1
TRAINlabel=$2
SPKR=$3
SPKRfiles=$4
SPKRlabel=$5


mkdir -p classes
cp global classes/

if [ -f "phones.stat" ];
then
    echo "phones.stat already exists"
else
    echo "Creating phone.stat..."
    HERest -H models/hmm0/vFloors -H models/hmm256/hmmdefs -I $TRAINlabel -M models/hmm256 -C config_2 -S $TRAINfiles -t 250. 150.0 1000.0 -s phones.stat phones
    HHEd -H models/hmm0/vFloors -H models/hmm256/hmmdefs -M classes regtree.hed phones
fi
mkdir -p "xforms_"$SPKR
HERest -T 4 -C config.global -C config_2 -S $SPKRfiles -H models/hmm0/vFloors -u a -H models/hmm256/hmmdefs -K "xforms_"$SPKR mllr1 -J classes -I $SPKRlabel phones

HERest -a -T 4 -C config.rc -C config_2 -S $SPKRfiles -H models/hmm0/vFloors -u a -H models/hmm256/hmmdefs -J "xforms_"$SPKR mllr1 -K "xforms_"$SPKR mllr2 -J classes -I $SPKRlabel phones


