############################################################### # markBurstsEtc.praat # # (c) 2006, Mary E. Beckman & Janet B. Pierrehumbert # # A script for marking the closure, burst (release), and VOT # times in the files for the KoreanStops exercise from # Mary E. Beckman & Janet B. Pierrehumbert (forthcoming). A # Laboratory Course in Phonology. A textbook in contract with # Blackwell, Inc. # ############################################################### # Preparatory stuff. # # Set the directory that you want to work on, # Revise the following as appropriate for your machine: # dir$="C:\Lx600.01\KoreanStops\allwav\" dir$="C:\Lx600.01\KoreanStops\H_files\" # Name the file in that directory into which you want this # script to store the results. results$=dir$+"results.txt" # Put a header row into the results file. fileappend "'results$'" file'tab$'C'tab$'pos'tab$'closure'tab$'burst'tab$'VOT'tab$'h1dB'tab$'h2dB'newline$' # Specify the consonant type, as being ... ## aspirated labial: # cType$="ph" ## tense labial: # cType$="pp" ## lax labial: cType$="b" # Specify the consonant position, as being ... ## IP initial # pos$="IP" ## AP initial # pos$="AI" ## AP-medial and only word-initial pos$="AM" ## word-medial and only syllable-initial # pos$="SY" # Revise the part that is after the 'dir$' as appropriate: # Create Strings as file list... fileList 'dir$'*.WAV # For example, for the aspirated labial in IP initial position: # Create Strings as file list... fileList 'dir$'HPHI*.WAV # Create Strings as file list... fileList 'dir$'HPPI*.WAV # Create Strings as file list... fileList 'dir$'HPI*.WAV # Create Strings as file list... fileList 'dir$'HPHAM*.WAV # Create Strings as file list... fileList 'dir$'HPPAM*.WAV Create Strings as file list... fileList 'dir$'HPAM*.WAV # Initialize the loop by counting the number of files named # in the Strings object called fileList that you created above. select Strings fileList nfiles=Get number of strings # Loop through the files named. for i from 1 to 'nfiles' # Get the ith file name and read in the WAV file. select Strings fileList fileName$=Get string... i Read from file... 'dir$''fileName$' To TextGrid... events events utt$=fileName$-".WAV" select Sound 'utt$' plus TextGrid 'utt$' Edit # Mark the closure beginning. pause Set cursor at the closure beginning editor TextGrid 'utt$' cTime=Get cursor endeditor select TextGrid 'utt$' Insert point... 1 'cTime' c # Mark the release burst pause Set cursor at the release burst editor TextGrid 'utt$' bTime=Get cursor endeditor select TextGrid 'utt$' Insert point... 1 'bTime' b # Mark the VOT in the following vowel pause Set cursor at the first glottal pulse in the vowel editor TextGrid 'utt$' Move cursor to nearest zero crossing vTime=Get cursor endeditor select TextGrid 'utt$' Insert point... 1 'vTime' v # Write the TextGrid object to a .TextGrid file. Write to text file... 'dir$''utt$'.TextGrid # Extract a 20 ms windowed selection that starts at the VOT. select Sound 'utt$' Edit editor Sound 'utt$' Select... 'vTime' 'vTime'+0.02 Extract windowed sound selection... slice Hanning 1 yes endeditor # Calculate a spectrum there and ask user to locate the H1 so # can extract the dB at the nearest frequency bin and at the # frequency bin that is twice that frequency (for H2). To Spectrum... yes To Ltas (1-to-1) select Spectrum slice Edit editor Spectrum slice Zoom... 0 1000 pause Place cursor at the first harmonic h1f=Get cursor endeditor select Ltas slice h1dB=Get value at frequency... 'h1f' Nearest h2dB=Get value at frequency... 'h1f'*2 Nearest # Write everything to the results file. fileappend "'results$'" 'utt$''tab$''cType$''tab$''pos$''tab$''cTime:3''tab$''bTime:3''tab$''vTime:3''tab$''h1dB:1''tab$''h2dB:1''newline$' # Clean up before moving on to the next file. select Sound 'utt$' plus TextGrid 'utt$' plus Sound slice plus Spectrum slice plus Ltas slice Remove endfor