##################################################### # wav-chopper.praat ( Kyuchul Yoon kyoon@ling.osu.edu ) # This script loops through all files in a folder and presents them for chopping # and saves chopped files in a diffferent folder with serial names ##################################################### form Specify files and folders word inFolder_(with_sound_files) sounds word inFileExt_(with_dot) .wav comment Output folder will be created with .chopped suffix endform outFolder$ = inFolder$ + ".chopped" system_nocheck mkdir 'outFolder$' Create Strings as file list... fileList 'inFolder$'/*'inFileExt$' numFiles = Get number of strings pause 'numFiles' sound files identified. Continue? for iFile to numFiles select Strings fileList fileName$ = Get string... iFile filePrefix$ = fileName$ - inFileExt$ Read from file... 'inFolder$'/'fileName$' Edit editor Sound 'filePrefix$' pause Select a REGION to chop or just click CONTINUE to go to next sound begin = Get begin of selection end = Get end of selection fileIndex = 1 while ((end-begin) > 0) choppedFileName$ = filePrefix$ + "-" choppedFileName$ = choppedFileName$ + "'fileIndex'" Write selection to WAV file... 'outFolder$'/'choppedFileName$'.wav Extract windowed selection... 'choppedFileName$' Rectangular 1 no fileIndex = fileIndex + 1 Select... 0 0 pause Select a REGION to chop or just click CONTINUE to go to next sound begin = Get begin of selection end = Get end of selection endwhile Close endeditor endfor ########### END OF SCRIPT ##############