# insertMidPoint.praat # # Script that opens all of the TextGrids in a directory # where you have stored the annotated wav files for one # of the talkers in the Hillenbrand corpus and inserts # a pointer in the "steadystate" tier at 50% of the way # through the demarcated vowel interval. # This is a form that lets you specify the directory and # the talker ID for the TextGrids files you want to read # in from the Hillenbrand et al. data. form Specify directory and talker sentence dir E:\795.10su2005\ word talker m01 endform # Create a Strings object that is the list of wav files for # the target talker and count the number of files in that list. Create Strings as file list... fileList 'dir$''talker$'*.TextGrid numFiles=Get number of strings # Loop through the file names in the list ... for i from 1 to 'numFiles' select Strings fileList fileName$=Get string... i # opening the file ... Read from file... 'dir$''fileName$' utt$=fileName$-".TextGrid" # and then set variables for the start and end times # of the second interval in the first tier. select TextGrid 'utt$' st=Get starting point... 1 2 et=Get end point... 1 2 midPoint='st' + ('et' - 'st')/2 thirtyPercentPoint='st' + ('et' - 'st')/3 noPoints=Get number of points... 2 if 'noPoints' = 0 Insert point... 2 'midPoint' 0.5 Insert point... 2 'thirtyPercentPoint' 0.3 Write to text file... 'dir$''utt$'.TextGrid endif endfor