#! Praat script p2/speakers/initTextGrid.praat.txt # This script puts a number of intervals at equal distances # through a new TextGrid. if numberOfSelected ("TextGrid") <> 1 or numberOfSelected ("Strings") <> 1 exit Select one TextGrid and one Strings object. endif textGrid = selected ("TextGrid") strings = selected ("Strings") form Fill TextGrid from Strings real First_time_(s) 5 real Last_time_(s) 100 real Interval_duration_(s) 1 endform select 'strings' number = Get number of strings for i to number select 'strings' string$ = Get string... i select 'textGrid' time = first_time + (i - 1) * (last_time - first_time) / (number - 1) Insert boundary... 1 time-interval_duration/2 Insert boundary... 1 time+interval_duration/2 Set interval text... 1 i*2 'string$' endfor