# # Praat script for measuring vowels for NORM # Version 3.3; Released 2010-04-22 # # http://qc.gphemsley.org/courses/LCD/391.3/2010-01/ # # Copyright (C) 2010 Gordon P. Hemsley # Licensed under a simplified BSD License # See LICENSE file for more details. # ############################################################################## ### INSTRUCTIONS ### ############################################################################## # # Before you use this script, you must edit the settings in the next section. # # The script will not function at all if you do not specify a speaker. # Do not use spaces or other special characters in the name of the speaker. # # If you would like the output file to be put somewhere other than the current # directory, specify that in the filepath, relative to this file. # # How To Use This Script: # # 1) In Praat, load the script into "Log script 3" or "Log script 4" by # entering the full path of the script into the menu accessed by executing # [ Query > Log settings... ]. # # 2) To measure monophthongs, put the cursor at the desired point or select an # entire segment to get the mean measurements over that range. # # 3) To measure diphthongs, you will have to run the script twice. For the # first run, select the initial steady-state position as if it were a # monophthong. For the second run, select the glide position. # # 4) To run the script, execute [ Query > Log script 3 ] or [ Query > Log # script 4 ], depending on what you did in Step 1. # # 5) In the first menu, specify the word you are measuring and a unique way to # refer to the vowel you are measuring. (The same vowel should always have # the same name.) You can use any system you want, as long as you are # consistent. Click OK when you are done. # # 6) The next menu will ask whether you are measuring a monophthong or a # diphthong. Give an honest answer. # # 7) On the second run of a diphthong measurement, the information you enter # in the first menu is discarded, so you can leave it blank. # # 8) If you have measured the initial position of a diphthong, but not its # glide position, Step 6 above will be different. Instead, it will ask you # whether you want to measure that glide position or pretend that you had # measured a monophthong and just move on to a new measurement. Again, be # honest. # # 9) Once you have completed these steps once, a file will appear with the # name of your speaker and the file extension '.tsv' (for tab-separated # file). When you have completed your measurements, you can feed this file # into NORM and have it plot all your vowels. # ############################################################################## ### SETTINGS ### ############################################################################## # Add speaker name between quotation marks. speaker$ = "" # Specify which directory to put the log files in. # Put path between quotation marks. (Do not include file name.) # Be sure to include trailing slash. # (Leave empty for current directory.) filepath$ = "" ############################################################################## ### DON'T EDIT BELOW THIS LINE ### ############################################################################## # Prompt the user for information about the vowel form Record vowel data sentence Word word Vowel_name endform # Set defaults measure_glide = 0 phthong = 1 # Prepare filenames data_file$ = filepath$ + speaker$ + ".tsv" glide_file$ = filepath$ + "praat.norm.glide." + speaker$ + ".txt" # Check to see if there is a glide open if ( fileReadable ( glide_file$ ) ) beginPause ( "Measure glide?" ) comment ( "You have a glide measurement pending. Would you like to measure it now?" ) measure_glide = endPause ( "Skip glide", "Measure glide", 2 ) endif # If there is no glide open, or an open glide was skipped, # ask what we are going to measure now. if ( ( measure_glide == 0 ) || ( measure_glide == 1 ) ) beginPause ( "Select phthong" ) comment ( "Please select phthong" ) phthong = endPause ( "Monophthong", "Diphthong", 1 ) endif f1 = Get first formant f2 = Get second formant f3 = Get third formant # Write to the file if ( !fileReadable ( data_file$ ) ) fileappend 'data_file$' Speaker'tab$'Vowel'tab$'Word'tab$'F1'tab$'F2'tab$'F3'tab$'F1g'tab$'F2g'tab$'F3g'newline$' endif # If we have to measure a glide, write the values at the end of the line. # If we skip an expected glide measurement, finish the line off empty. if ( measure_glide != 0 ) if ( measure_glide == 2 ) fileappend 'data_file$' 'f1:0''tab$''f2:0''tab$''f3:0''newline$' elsif ( measure_glide == 1 ) fileappend 'data_file$' 'tab$''tab$''newline$' endif filedelete 'glide_file$' endif # If we are measuring a new diphthong, write the beginning of the line. # Otherwise, write the full line. if ( measure_glide != 2 ) if ( phthong == 2 ) fileappend 'data_file$' 'speaker$''tab$''Vowel_name$''tab$''Word$''tab$''f1:0''tab$''f2:0''tab$''f3:0''tab$' # Create temp file to keep track of glides. data_file$ > 'glide_file$' else fileappend 'data_file$' 'speaker$''tab$''Vowel_name$''tab$''Word$''tab$''f1:0''tab$''f2:0''tab$''f3:0''tab$''tab$''tab$''newline$' endif endif