#!/bin/sh



# This produces label files that mark the edges
# of the utterances.

o=/tmp/$$.dat
trap "rm -f $o" EXIT

L=$OXILIB
OL=$OXIROOT/lib
M=$MIMICROOT/Analysis/bin

rewrite=0
if test "$1" = '-rewrite'
then
  rewrite=1
fi

for n in $(select_fiat_entries.py -show "'%s/%s' % (d, f)" DB.fiat)
do
    echo 'Working on' $n
    if test ! -s $n.loud.dat
    then
      g_die "No data: $n" || exit 1
    elif test $rewrite = 1 -o $n.loud.dat -nt $n.lbl
    then
      rm -f $n.lbl
      python $OL/find_utterance_edges_n.py -label $n.lbl $n || g_die "Find_utterance_edges_n fails on $n!" || exit 1
    fi
done

