#!/bin/bash

set -x

tdata=$1
rec=$2
p=$3
flags="$4"
V=$5	#V=0.01

ti=tmpE$p
tj=tmpE$((p+1))

W=2

phones=$(cat $tdata/generated_phones | tr ' ' '\012')

tlist=$ti/trainlist.tmp
for phn in $phones
do
  # NB: Cannot parallelize this because each call to HRest could write to $tj/ph/macros
  HRest -A -D -T 1 -t -v $V -i 60 -X lab -C $rec/config	\
  	-H $tj/ph/macros -L $tj/lab -S $tlist -M $tj/ph -l $phn $ti/ph/$phn ||
	die.sh "HRest" || exit 1
done
	# -u "$flags" -w 1.5	\
