annotate experiments/scripts/cnbh-syllables/feature_generation/run_hcopy.sh @ 191:3e85304075a9

- AWS
author tomwalters
date Thu, 12 Aug 2010 08:44:41 +0000
parents b44be313367b
children
rev   line source
tomwalters@54 1 #!/bin/bash
tomwalters@54 2
tomwalters@54 3 HCOPY=`which HCopy`
tomwalters@182 4 if [ "$HCOPY" == "" ]; then
tomwalters@54 5 echo "Please build HTK and make the binaries available in the path"
tomwalters@54 6 fi
tomwalters@54 7
tomwalters@54 8 set -e
tomwalters@54 9 set -u
tomwalters@54 10
tomwalters@54 11 FEATURES_DIR=$1
tomwalters@54 12 MACHINE_CORES=$2
tomwalters@54 13 FILE_LIST=feature_generation_script
tomwalters@54 14 HCOPY_CONFIG=hcopy_configuration
tomwalters@54 15
tomwalters@54 16 echo "Creating HCopy config file..."
tomwalters@54 17 cat <<"EOF" > $FEATURES_DIR/${HCOPY_CONFIG}
tomwalters@54 18 # Coding parameters
tomwalters@54 19 SOURCEFORMAT= WAV
tomwalters@54 20 TARGETKIND = MFCC_0_D_A
tomwalters@54 21 TARGETRATE = 100000.0
tomwalters@54 22 SAVECOMPRESSED = T
tomwalters@54 23 SAVEWITHCRC = T
tomwalters@54 24 WINDOWSIZE = 250000.0
tomwalters@54 25 USEHAMMING = T
tomwalters@54 26 PREEMCOEF = 0.97
tomwalters@54 27 NUMCHANS = 200
tomwalters@54 28 CEPLIFTER = 22
tomwalters@54 29 NUMCEPS = 12
tomwalters@54 30 ENORMALISE = F
tomwalters@54 31 # Parameters a bit like Welling and Ney (2002)
tomwalters@54 32 # Can't do zero, it seems.
tomwalters@54 33 # WARPLCUTOFF = 10
tomwalters@54 34 # Upper frequency is the Nyquist freq. (24000Hz)
tomwalters@54 35 # so choose the break freq. close to that
tomwalters@54 36 # WARPUCUTOFF = 23000
tomwalters@54 37 EOF
tomwalters@54 38
tomwalters@54 39 echo "Splitting data files over cores..."
tomwalters@54 40 total_cores=$(($MACHINE_CORES))
tomwalters@54 41 echo -n $total_cores
tomwalters@54 42 echo " cores available"
tomwalters@54 43 total_files=`cat $FEATURES_DIR/$FILE_LIST | wc -l | sed 's/ *//'`
tomwalters@54 44 echo -n $total_files
tomwalters@54 45 echo " files to process"
tomwalters@54 46 files_per_core=$(($total_files/$total_cores+1))
tomwalters@54 47 echo -n $files_per_core
tomwalters@54 48 echo " files per core"
tomwalters@54 49 split -l $files_per_core $FEATURES_DIR/$FILE_LIST $FEATURES_DIR/split_list
tomwalters@54 50 splits=( $(ls $FEATURES_DIR/split_list*))
tomwalters@54 51 element=0
tomwalters@54 52 echo -n "Spawning "
tomwalters@54 53 echo -n $total_cores
tomwalters@54 54 echo " tasks..."
tomwalters@54 55 for ((c=1;c<=$MACHINE_CORES;c+=1)); do
tomwalters@54 56 s=${splits[$element]}
tomwalters@184 57 HCopy -T 1 -C $FEATURES_DIR/${HCOPY_CONFIG} -S $s &
tomwalters@54 58 let element=element+1
tomwalters@54 59 done
tomwalters@54 60
tomwalters@54 61 echo "Waiting for tasks to complete..."
tomwalters@54 62 wait
tomwalters@54 63 echo "Done!"