þÿ############################################################### # measureLiquids.praat (Written by Kyuchul Yoon, kyoon@yu.ac.kr ############################################################### # Given a long sound file, this script prompts the user to # labels target words one by one and presents the labeled target # words for measuring the liquid(s). # A separate text file containing the list of target words in # one column needs to be in the same folder as this script. ############################################################### ############## STAGE 1: Target word labeling ############### form Specify parameters word inputFile_(name_of_sound_file_without_dot_wav) É-¬²äÅ`2 word targetWordList_(containing_the_list_of_target_words) targetList2.txt word tierName1_(tier_of_target_word) target word tierName2_(tier_of_liquid) liquid real windowSizeLiquid_(size_for_measuring_liquid_in_sec) 0.6 comment A text log file with the inputFile prefix will be created endform Read Strings from raw text file... 'targetWordList$' numOfWords = Get number of strings Rename... targetWordListObj logName$ = inputFile$ + "-log.txt" fileappend 'logName$' word'tab$'L_start'tab$'L_end'tab$'duration'newline$' Open long sound file... 'inputFile$'.wav Rename... longSoundObj To TextGrid... 'tierName1$' 'tierName2$' Rename... longTextGridObj plus LongSound longSoundObj Edit interval = 2 for i to numOfWords select Strings targetWordListObj currentTargetWord$ = Get string... i editor TextGrid longTextGridObj pause Highlight the target word and press Continue! start = Get start of selection end = Get end of selection endeditor select TextGrid longTextGridObj Insert boundary... 1 start Insert boundary... 1 end Set interval text... 1 (interval*i) 'currentTargetWord$' endfor select TextGrid longTextGridObj Write to text file... 'inputFile$'.TextGrid ############# STAGE 2: Liquid labeling ############### Insert interval tier... 2 'tierName2$' select LongSound longSoundObj plus TextGrid longTextGridObj for j to numOfWords intervalNum = j*2 select TextGrid longTextGridObj intervalText$ = Get label of interval... 1 intervalNum start = Get starting point... 1 intervalNum end = Get end point... 1 intervalNum editor TextGrid longTextGridObj Zoom... start end pause Highlight the LIQUID and press Continue! start = Get start of selection end = Get end of selection duration = end - start endeditor select TextGrid longTextGridObj Insert boundary... 2 start Insert boundary... 2 end Set interval text... 2 intervalNum liquid fileappend 'logName$' 'intervalText$''tab$''start''tab$''end' ...'tab$''duration''newline$' endfor select TextGrid longTextGridObj Write to text file... 'inputFile$'.TextGrid ############# END OF SCRIPT ###############