# Change this to specify the directory where you are working directory$ = "/Users/kchall/Documents/Acquisition/Exercise_3_Vowels/adults" # Create a list of files named something.TextGrid and count the strings Create Strings as file list... fileList 'directory$'/*.TextGrid numFiles = Get number of strings # Loop through the files for iFile from 1 to 'numFiles' # Get the file name and extract the base part and read in the wav and # TextGrid files from the directory, and extract the time of the peak. utt$ = Get string... iFile utt$ = utt$ - "-KCH.TextGrid" Read from file... 'directory$'/'utt$'.wav To Formant (burg)... 0 5 6000 0.025 50 Read from file... 'directory$'/'utt$'-KCH.TextGrid tbeg = Get starting point... 1 2 tend = Get end point... 1 2 Remove dur = 'tend' - 'tbeg' mid = tbeg + (dur/2) q1 = tbeg + (dur/4) q3 = tend - (dur/4) select Formant 'utt$' f1q1 = Get value at time... 1 'q1' Hertz Linear f2q1 = Get value at time... 2 'q1' Hertz Linear f1mid = Get value at time... 1 'mid' Hertz Linear f2mid = Get value at time... 2 'mid' Hertz Linear f1q3 = Get value at time... 1 'q3' Hertz Linear f2q3 = Get value at time... 2 'q3' Hertz Linear Remove fileappend "'directory$'/formants.txt" 'tab$' 'utt$' 'tab$' 'dur' 'tab$' 'f1q1' 'tab$' 'f2q1' 'tab$' 'f1mid' 'tab$' 'f2mid' 'tab$' 'f1q3' 'tab$' 'f2q3' 'tab$' 'newline$' select Sound 'utt$' Remove select Strings fileList endfor