# This script takes all the files in the specified directory, modify their scales, # and writes new files to a new folder called "output", which it automatically creates. # The input directory is where the sound files are; the default option is where this script is. # Peak is your desired maximum amplitude. # version 4/7/2009 form Files sentence InputDir ./ positive Peak 0.80 endform # Create an output directory createDirectory ("output") # this lists everything in the directory into what's called a Strings list # and counts how many there are Create Strings as file list... list 'inputDir$'*.wav numberOfFiles = Get number of strings # then it loops through, doing some actions for every file in the list for ifile to numberOfFiles # opens each file, one at a time select Strings list fileName$ = Get string... ifile Read from file... 'inputDir$''fileName$' # and scales peak and write to a new wav file Scale peak... 'peak' Write to WAV file... ./output/'fileName$' # then remove all the objects except the strings list so praat isn't all cluttered up select all minus Strings list Remove endfor # at the very end, remove any other objects sitting around - like the strings list select all Remove