# just a quick and dirty work for converting formant listing output # of praat to F1 F2 data table for "vowel-each.R" # Input: - vowel label must be enclosed in [] # - one block for one vowel # e.g. # Name # #[a] #Time_s F1_Hz F2_Hz F3_Hz F4_Hz #0.898113 618.405918 1214.780910 2803.739487 3550.125368 # #[i] #Time_s F1_Hz F2_Hz F3_Hz F4_Hz #1.388073 262.382360 2157.813512 2807.671771 3401.515422 # Output: # 2005-05-05 # Mafuyu Kitahara $file = 'aiueoF1F2'; open (DATA, "$file"); open (OUT, ">$file.data"); $/ = ""; # block mode, empty line as separator $* = 1; print OUT " F1 \t F2 \n"; while () { @col = split; if ($col[0] =~/\[a\]/){ undef $where; for ($[ .. $#col) { $where = $_, last if $col[$_] =~/^[0-9]/; } print OUT "a $col[($where+1)] \t $col[($where+2)]\n"; } if ($col[0] =~/\[i\]/){ undef $where; for ($[ .. $#col) { $where = $_, last if $col[$_] =~/^[0-9]/; } print OUT "i $col[($where+1)] \t $col[($where+2)]\n"; } if ($col[0] =~/\[u\]/){ undef $where; for ($[ .. $#col) { $where = $_, last if $col[$_] =~/^[0-9]/; } print OUT "u $col[($where+1)] \t $col[($where+2)]\n"; } if ($col[0] =~/\[e\]/){ undef $where; for ($[ .. $#col) { $where = $_, last if $col[$_] =~/^[0-9]/; } print OUT "e $col[($where+1)] \t $col[($where+2)]\n"; } if ($col[0] =~/\[o\]/){ undef $where; for ($[ .. $#col) { $where = $_, last if $col[$_] =~/^[0-9]/; } print OUT "o $col[($where+1)] \t $col[($where+2)]\n"; } }