######################################################### # measure-duration-of-ga-and-optional-pause.praat # Written by Kyuchul Yoon Feb-13-2005 kyoon@ling.osu.edu # Measures the duration of all the files specified. ######################################################### form Specify files and folders word inputFolder textgridFolder word inputExt_(with_dot) .TextGrid natural tierToScan 2 word sylToScan ga word optionalPause pause word outputFile_(to_be_created) durations.txt endform Create Strings as file list... textgridListObj 'inputFolder$'/*'inputExt$' numFiles = Get number of strings pause 'numFiles' textgrid identified. Continue? fileappend 'outputFile$' TextGrid'tab$'durationOf_ga'tab$'durationOf_pause'newline$' for iFile to numFiles select Strings textgridListObj fileName$ = Get string... iFile Read from file... 'inputFolder$'/'fileName$' Rename... textgridObj numIntervals = Get number of intervals... tierToScan flagPause = 0 for iInterval to numIntervals intervalText$ = Get label of interval... tierToScan iInterval if intervalText$ = sylToScan$ startTimeSyl = Get starting point... tierToScan iInterval endTimeSyl = Get end point... tierToScan iInterval durationSyl = endTimeSyl - startTimeSyl fileappend 'outputFile$' 'fileName$''tab$''durationSyl:2' ...'tab$' endif if intervalText$ = optionalPause$ flagPause = 1 startTimePause = Get starting point... tierToScan iInterval endTimePause = Get end point... tierToScan iInterval durationPause = endTimePause - startTimePause fileappend 'outputFile$' 'durationPause:2''newline$' endif endfor if flagPause = 0 fileappend 'outputFile$' 0.00'newline$' endif select TextGrid textgridObj Remove endfor select Strings textgridListObj Remove ########## END OF SCRIPT #############