###################################################################### # AP-transcriber.praat (Written by Kyuchul Yoon, kyoon@kyungnam.ac.kr) # Prompts one sound file at a time. The user then has to select the # target AP area (given in a separate text file) and press Continue. # The script will insert boundary points to the AP area and default # tones. The user then manually corrects the tone labels and completes # the labeling process. ###################################################################### form Specify parameters word inFolder 01_1_iyl word inSoundExt_(with_dot) .wav word textGridExt_(with_dot) .TextGrid natural multiplyFactor 10 comment Tone tier names word tier1_(phonological_tone_tier) phonological word tier2_(phonetic_tone_tier) phonetic comment A subfolder will be created with .done suffix endform # Create the subfolder to store finished sound files and their TextGrids outFolder$ = inFolder$ + ".done" system_nocheck mkdir 'outFolder$' # Make a list of files in the input folder Create Strings as file list... fileListObj 'inFolder$'/*'inSoundExt$' numFiles = Get number of strings # Loop through each file in the folder for iFile to numFiles select Strings fileListObj soundName$ = Get string... iFile prefix$ = soundName$ - inSoundExt$ textGridName$ = prefix$ + textGridExt$ Read from file... 'inFolder$'/'soundName$' Rename... soundObj # The amplitude is too low. Make it sound louder Multiply... multiplyFactor # Create a TextGrid file To TextGrid... "'tier1$' 'tier2$'" 'tier1$' 'tier2$' Rename... textGridObj plus Sound soundObj Edit editor TextGrid textGridObj pause 'soundName$'. Select the target AP and press Continue startAP = Get start of selection endAP = Get end of selection lengthAP = endAP - startAP endeditor # Insert boundaries select TextGrid textGridObj Insert point... 1 startAP Insert point... 1 endAP LHa # Divide the total AP duration by five (for four points) intervalOfPoints = lengthAP/5 pointAP1 = startAP + intervalOfPoints pointAP2 = startAP + intervalOfPoints*2 pointAP3 = startAP + intervalOfPoints*3 pointAP4 = startAP + intervalOfPoints*4 Insert point... 2 pointAP1 L Insert point... 2 pointAP2 +H Insert point... 2 pointAP3 L+ Insert point... 2 pointAP4 Ha pause Press Continue when done # Save the finished files to the output folder Write to text file... 'outFolder$'/'textGridName$' select Sound soundObj Write to WAV file... 'outFolder$'/'soundName$' filedelete 'inFolder$'/'soundName$' plus TextGrid textGridObj Remove endfor select Strings fileListObj Remove ############## END OF SCRIPT ##############