annotate trunk/experiments/scripts/cnbh-syllables/feature_generation/run_hcopy.sh @ 706:f8e90b5d85fd tip

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