############################################################################ # check_wav-TextGrid.praat (Written by Kyuchul Yoon, kyoon@kyungnam.ac.kr) # Prompt pairs of wav/TextGrid files in the specified absolute folder path # How to install as a fixed menu in the Objects window # (1) Open this script : Praat ==> Open Praat script... # (2) In the script window : File ==> Add to fixed menu... # (3) In the Add to fixed menu dialog box : Menu => Read # Command => Check wav/textgrid # Press OK # (4) In the Praat Objects window : Check under the Read menu, the last one ############################################################################ form Specify parameters word inputWav_(absolute_path) test word inputTextGrid_(absolute_Path) test word wavExt_(with_dot) .wav word textgridExt_(with_dot) .TextGrid comment Check if you want modified .TextGrid files to be saved. choice SaveModified: 1 button No button Yes word outputFolder_(absolute_path) folder2 endform if saveModified$ = "Yes" system_nocheck mkdir 'outputFolder$' endif Create Strings as file list... fileListObj 'inputWav$'/*'wavExt$' Sort numFiles = Get number of strings for iFile to numFiles select Strings fileListObj wavName$ = Get string... iFile Read from file... 'inputWav$'/'wavName$' Rename... wavObj prefix$ = wavName$ - wavExt$ textgridName$ = prefix$ + textgridExt$ Read from file... 'inputTextGrid$'/'textgridName$' Rename... textgridObj plus Sound wavObj Edit pause 'wavName$' / 'textgridName$' if saveModified$ = "Yes" select TextGrid textgridObj Write to text file... 'outputFolder$'/'textgridName$' endif select TextGrid textgridObj plus Sound wavObj Remove endfor select Strings fileListObj Remove ######### END OF SCRIPT ############