########### Gregory Anderson form Directories and Parameters sentence Subject S sentence Sound_file_extension .wav endform ########### Create text file for spectrum data resultfile$ = "/Volumes/SpeechData/Dissertation/RobotSpeech/TextFiles/" + subject$ + "Pitch.txt" ########### Here, you make a listing of all the sound files in a directory. sound_directory$ = "/Volumes/SpeechData/Dissertation/RobotSpeech/AudioFiles/" + subject$ + "/" Create Strings as file list... list 'sound_directory$'*'sound_file_extension$' numberOfFiles = Get number of strings ########### Check if the result file exists: if fileReadable (resultfile$) pause The result file 'resultfile$' already exists! Do you want to overwrite it? filedelete 'resultfile$' endif ########### Save result to text file: resultline$ = "Subject/Utterance Hz Mean Hz SD 'newline$'" fileappend "'resultfile$'" 'resultline$' ########### Go through all the sound files, one by one: for ifile to numberOfFiles filename$ = Get string... ifile Read from file... 'sound_directory$''filename$' soundname$ = selected$ ("Sound", 1) ########### Pitch measures select Sound 'soundname$' To Pitch (ac)... 0 75 15 no 0.03 0.5 0.01 0.35 0.3 400 hzmean = Get mean... 0 0 Hertz hzSD = Get standard deviation... 0 0 Hertz ########### Save result to text file: resultline$ = "'soundname$' 'hzmean' 'hzSD' 'newline$'" fileappend "'resultfile$'" 'resultline$' ########### Remove the temporary objects from the object list select Sound 'soundname$' plus Pitch 'soundname$' plus Pitch 'soundname$' Remove select Strings list ########### and go on with the next sound file! endfor select Strings list Remove exit