-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathalign_and_extract.sh
executable file
·42 lines (34 loc) · 1.41 KB
/
align_and_extract.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
taskdir=$1
task=$2
delstopwords=$3
maxbandwidth=$4
delunstressedvowels=$5
dot="$(cd "$(dirname "$0")"; pwd)"
favedir=$dot'/FAVE-extract'
stopwords=$dot'/stopwords.txt'
#get alignments
mkdir -p $taskdir'/aligned'
if [ $task == 'asr' ] || [ $task == 'azure' ] || [ $task == 'bound' ] || [ $task == 'txt' ] ; then
mkdir -p $taskdir'/tmp'
$dot'/montreal-forced-aligner/bin/mfa_align' $taskdir $taskdir'/pron.dict' english $taskdir'/aligned' -t $taskdir'/tmp' -i -j 2
# flip phone and word tiers so phone is 0 and word is 1
python $dot'/fliptiers.py' $taskdir'/aligned/audio.TextGrid' $taskdir'/aligned/audio.ordered.TextGrid'
fi
if [ $task == 'extract' ]; then
# order phone and word tiers so phone is 0 and word is 1
python $dot'/fliptiers.py' $taskdir'/raw.TextGrid' $taskdir'/aligned/audio.ordered.TextGrid'
fi
#run FAVE-extract
python $favedir/bin/extractFormants.py \
--means=$favedir/means.txt \
--covariances=$favedir/covs.txt \
--phoneset=$favedir/cmu_phoneset.txt \
--speaker=$taskdir'/speaker' \
--removeStopWords=$delstopwords \
--onlyMeasureStressed=$delunstressedvowels \
--stopWordsFile=$stopwords \
--maxBandwidth=$maxbandwidth \
$taskdir'/audio.wav' $taskdir'/aligned/audio.ordered.TextGrid' $taskdir'/aggvowels' &> $taskdir'/fave_errors.log';
#plot
Rscript plot_vowels.r $taskdir'/aggvowels_formants.csv' $taskdir'/fornorm.tsv' $taskdir'/plot.pdf'