# For each vowel interval selected in the script "TagVowels.praat," go through and # measure F1, F2, and F3 at the 20%, 50%, and 80% points. This will give you the # measurements you need for both monophthongs and diphthongs (or so we hope). form Specify the directory, utterance, and list file. sentence dir D:\CODTemp\ sentence tgdir F:\79510data\ word speaker vita_050705_pt1 word vowel uw endform # Begin by reading in the audio file. Then, checks to see if a TextGrid object exists. # If not, then warns the user the TextGrid does not exist. tgFile$=tgdir$+speaker$+".TextGrid" Open long sound file... 'dir$''speaker$'.wav if fileReadable(tgFile$) Read from file... 'tgFile$' else exit Dude, you need to run TagVowels.praat first. endif # Determine what the output file name should be where you log # the times and tags for this vowel for this speaker. outFile$=tgdir$+speaker$+"_"+vowel$+"_formants.txt" # Open the LongSound and TextGrid objects together in the Edit window. select LongSound 'speaker$' plus TextGrid 'speaker$' Edit # Count the number of intervals in the vowel tier. select TextGrid 'speaker$' noInts = Get number of intervals... 3 # Loop through the intervals in the vowel tier and # make sure you have the right vowel. If yes, then extract the formants. for i from 1 to 'noInts' select TextGrid 'speaker$' lab$ = Get label of interval... 3 i if lab$ = vowel$ st= Get starting point... 3 i et= Get end point... 3 i thisWord= Get interval at time... 2 'st' wordLab$= Get label of interval... 2 'thisWord' # calculate 20, 50, and 80 % points t20 = 'st' + ('et'-'st')*0.2 t50= 'st'+('et'-'st')*0.5 t80='st'+('et'-'st')*0.8 Insert point... 5 't20' t20 Insert point... 5 't50' t50 Insert point... 5 't80' t80 editor TextGrid 'speaker$' Select... 'st' 'et' Zoom... 'st' 'et' pause Confirm formant measurement points Move cursor to... 't20' f1t20=Get first formant f2t20=Get second formant f3t20=Get third formant Move cursor to... 't50' f1t50=Get first formant f2t50=Get second formant f3t50=Get third formant Move cursor to... 't80' f1t80=Get first formant f2t80=Get second formant f3t80=Get third formant endeditor fileappend "'outFile$'" 'wordLab$''tab$''st:3''tab$''et:3''tab$''f1t20:0''tab$''f2t20:0''tab$''f3t20:0''tab$''f1t50:0''tab$''f2t50:0''tab$''f3t50:0''tab$''f1t80:0''tab$''f2t80:0''tab$''f3t80:0''newline$' endif endfor