comparison trunk/experiments/scripts/cnbh-syllables/feature_generation/gen_hcopy_aimcopy_script.sh @ 335:71c438f9daf7

- Scripts for running recognition experiments using AIM-C and HTK to compare MFCCs against features generated with AIM-C
author tomwalters
date Wed, 04 Aug 2010 06:41:56 +0000
parents
children 7074795fd2eb
comparison
equal deleted inserted replaced
334:4ee5bb246f60 335:71c438f9daf7
1 #!/bin/bash
2 # Copyright 2009-2010 Thomas Walters <tom@acousticscale.org>
3 #
4 # Generate a list of source and destination filenames from the syllables spoke
5 # pattern. This list can be used as a script for HTK's HCopy and AIM-C's
6 # AIMCopy binaries for generating features.
7 #
8 # The first argument is the path to the root directory for the features to be
9 # generated in. The second argument is the path to the sounds database.
10 #
11 # Generated files:
12 # feature_generation_script - The AIMCopy / HCopy script
13
14 FEATURES_DIR=$1
15 SOUND_SOURCE=$2
16
17 FULL_LIST=feature_generation_script
18
19 # Temporary file names
20 SYLLIST=syllable_list
21 TALKERS=talker_list
22
23 # The vowels and consonants that make up the CNBH database
24 VOWELS="a e i o u"
25 CONSONANTS="b d f g h k l m n p r s t v w x y z"
26
27 if [ ! -e $FEATURES_DIR/.features_script_success ]; then
28 mkdir -p $FEATURES_DIR
29
30 # Make the sets of VC, CV, and vowel only labels, plus silence and use them to
31 # generate the grammar, dictionary and list of syllables
32 if [ -a $FEATURES_DIR/$SYLLIST.tmp.tmp ]
33 then
34 rm $FEATURES_DIR/$SYLLIST.tmp.tmp
35 fi
36
37 for v in $VOWELS; do
38 for c in $CONSONANTS; do
39 echo $v$c >> $FEATURES_DIR/$SYLLIST.tmp.tmp
40 echo $c$v >> $FEATURES_DIR/$SYLLIST.tmp.tmp
41 done
42 done
43
44 # Sort the syllable list and delete the
45 # temporary, unsorted version
46 sort $FEATURES_DIR/$SYLLIST.tmp.tmp > $FEATURES_DIR/$SYLLIST.tmp
47 rm $FEATURES_DIR/$SYLLIST.tmp.tmp
48
49 cat <<"EOF" > $FEATURES_DIR/${TALKERS}.tmp
50 170.9p112.2s
51 171.0p112.8s
52 171.3p111.7s
53 171.5p113.1s
54 171.9p111.5s
55 172.1p113.0s
56 172.4p111.9s
57 172.5p112.5s
58 171.7p112.3s
59 137.0p104.3s
60 141.3p135.4s
61 145.5p106.3s
62 148.8p128.8s
63 151.6p83.9s
64 153.0p108.1s
65 155.5p123.5s
66 156.7p90.6s
67 159.5p109.6s
68 161.1p119.4s
69 161.1p96.8s
70 163.4p157.6s
71 164.7p110.8s
72 164.9p102.1s
73 165.6p144.0s
74 165.7p116.2s
75 167.4p133.5s
76 167.8p106.5s
77 168.6p111.6s
78 168.9p125.4s
79 169.0p114.0s
80 170.0p109.7s
81 170.1p119.5s
82 171.0p115.5s
83 172.4p109.3s
84 173.3p105.6s
85 173.5p115.0s
86 174.5p100.6s
87 174.5p110.6s
88 174.9p113.0s
89 175.7p118.5s
90 176.1p94.5s
91 178.0p108.5s
92 178.1p87.6s
93 178.8p123.6s
94 179.0p113.9s
95 180.4p80.1s
96 183.0p105.7s
97 183.0p130.4s
98 184.8p115.1s
99 188.1p139.2s
100 189.6p102.1s
101 192.7p116.7s
102 194.5p150.4s
103 198.1p97.9s
104 202.7p118.6s
105 208.6p93.2s
106 215.2p121.0s
107 EOF
108
109 echo "Generating script..."
110 exec 3> $FEATURES_DIR/$FULL_LIST
111 for syllable in $(cat $FEATURES_DIR/${SYLLIST}.tmp); do
112 for speaker in $(cat $FEATURES_DIR/${TALKERS}.tmp); do
113 SOURCE_FILENAME=$SOUND_SOURCE/$syllable/${syllable}${speaker}.wav
114 DEST_FILENAME=$FEATURES_DIR/$syllable/${syllable}${speaker}.htk
115 echo "$SOURCE_FILENAME ${DEST_FILENAME}" >&3
116 done
117 done
118 exec 3>&-
119
120 # Make the necessary directories for the computed features
121 echo "Making directory structure..."
122 for syllable in $(cat $FEATURES_DIR/${SYLLIST}.tmp); do
123 mkdir -p $FEATURES_DIR/$syllable
124 done
125
126 rm $FEATURES_DIR/$SYLLIST.tmp
127 rm $FEATURES_DIR/${TALKERS}.tmp
128 touch $FEATURES_DIR/.features_script_success
129 fi