Tryag File Manager
Home
-
Turbo Force
Current Path :
/
home
/
cluster1
/
data
/
bu01
/
1121861
/
html
/
poser
/
Foley programs and data
/
spd24_nahuatl_dat_am
/
Upload File :
New :
File
Dir
//home/cluster1/data/bu01/1121861/html/poser/Foley programs and data/spd24_nahuatl_dat_am/fromVad.perl~
#!/usr/bin/perl $usage = "fromVad.perl logfile_prefix\n"; if (@ARGV < 1) {print $usage; die;} $minLength = 0.3; # the minimum acceptable word length in seconds $margin = 0.5; # The amount of silence on each side of a word $errorMargin = 0.3; # how wrong I expect the log files to be $beepMargin = 0; # the margin between a reported beep and a real # beep. $fileName = $ARGV[0]; open (VF, "$fileName.vad"); open (TF, "$fileName.time"); open (BEEPLOG, "/pkg/ldc/talkbank/nahuatl/DAT/am/log/logFileAdjustments.text"); while (<BEEPLOG>) { chomp; if (/$fileName/) {$beepMargin = ((split)[1]);} } $vf_counter = 0; $tf_counter = 0; while (<VF>) { @t = split; $vf_start[$vf_counter] = $t[3]; $vf_end[$vf_counter] = $t[7]; $vf_length[$vf_counter] = $vf_end[$vf_counter] - $vf_start[$vf_counter]; $vf_counter++; } while (<TF>) { @t = split(/\t/); @s = split; #if (/REDO/) { $tf_start[$tf_counter] = $s[0]; $tf_end[$tf_counter] = $s[1]; $tf_id[$tf_counter] = $t[1]; $tf_word[$tf_counter] = $t[2]; $tf_type[$tf_counter] = $t[3]; $tf_counter++; #} } for ($p=0;$p<$tf_counter; $p++) { $q = 0; while ($q < $vf_counter) { if (($vf_start[$q] >= ($tf_start[$p] - $beepMargin - $errorMargin)) && ($vf_end[$q] <= ($tf_end[$p] - $beepMargin + $errorMargin)) && ($vf_length[$q] >= $minLength)) { $startAdjusted = $vf_start[$q] - $margin; $endAdjusted = $vf_end[$q] + $margin; printf( "%9.3f%9.3f\t$tf_id[$p]\t%-28s\t%9.2f\t$tf_type[$p]", $startAdjusted,$endAdjusted,$tf_word[$p],$vf_length[$q]); } $q++ } }