# vowel_loop # Praat script for synthesizing a 22x15 (=330) array of vowel stimuli for # the vowel space in Keith Johnson's "method of adjustment paradigm # for the study of vowel perception" (see Johnson, Fleming, & Wright, # 1993, The hyperspace effect: phonetic targets are hyperarticulated, # Language 69, 505-528). The values specified are based on the files # male.doc and makemale.c available from # ftp://ftp.ling.ohio-state.edu/pub/phonetics/estimate # Set the directory where you have the source files and want to store # the output. On my machine it is C:\klsyn\praatVowels. Modify as # appropriate for your machine directory$="C:\klsyn\praatVowels" # Choose the source file. The first one is a 385 ms pulsetrain, with a # constant 100 Hz 50% open quotient pulse, created with the script # createpulsetrain. The second is made from the Male.wav synthesized # using klsyn from the original male.doc file. I made an autocorrelation # LPC analysis using the default values in Praat, and then inverse # filtered the Male.wav file using the LPC filter to extract the source. # Comment out the one you don't want. Whichever one you choose # should be placed in your working directory. # Use the following if you want to have a steady amplitude and F0 # sourcefile$="PulseTrain385ms100Hz50percentOQ" # Use the following if you want to have a slightly changing amplitude # and F0 contour, as in the male.doc file sourcefile$="sourceMale" Read from file... 'directory$'\'sourcefile$'.wav # create a log file for the wavfile names and formant values listFile$="'directory$'\formantList.txt" # filedelete 'listFile$' # Initialize the values as in Keith Johnson's makemale.c program # this is a 22 (F2) by 15 (F1) grid, ranging from 800 Hz to 2500 Hz # on the horizontal (F2) axis and from 250 Hz to 900 Hz on the # vertical (F1) axis f1steps=15 f2steps=22 f1min=250 f1max=900 f2min=800 f2max=2500 # Calculate the Bark equivalents for minimum and maximum values # using formulae from Schroeder, Atal, & Hall (1979) Optimizing digital # speech coders by exploiting masking properties of the human ear. # J. Acoust. Soc. Am. 66, 1647-1652. (See also the praat function # Excitation_hertzToBark, which would do the equivalent.) temp='f1max'/650 maxz1=7*ln('temp'+sqrt('temp'*'temp'+1)) temp='f1min'/650 minz1=7*ln('temp'+sqrt('temp'*'temp'+1)) temp='f2max'/650 maxz2=7*ln('temp'+sqrt('temp'*'temp'+1)) temp='f2min'/650 minz2=7*ln('temp'+sqrt('temp'*'temp'+1)) # Calculate F1 and F2 increments in Bark units. The increment for # F1 is 0.37665 Bark and the one for F2 is 0.3404 Bark. Compare the # 0.37 Bark increments for both F1 and F2 in Johnson et al. (1993), # which was described as "slightly larger than the just-noticeable- # differences for vowel formants reported in Flanagan 1957" (p. 509). z1inc=('maxz1'-'minz1')/('f1steps'-1) z2inc=('maxz2'-'minz2')/('f2steps'-1) # initialize z1 to minz1 and start looping through the F1 values z1='minz1' # Outer loop for the first formant values starts here for iF1 from 1 to 'f1steps' # Calculate the first formant frequency and bandwidth f1=650*sinh('z1'/7) # The following is the formula in makemale.doc and should be # commented if you want to follow the formulae in vow_arr.c # instead. See the formulae for bandwidths in the inner loop. b1=(38.498+0.05859*'f1') # Calculate the F4 frequency and bandwidth, which depend only # upon the F1. f4 = 3212.16 + 0.842*'f1' b4 =(38.498+0.05859*'f4') # initialize z2 and start looping through the F2 values z2='maxz2' oldf2='z2' iF2 = 'f2steps' # Inner loop through the second formant values starts here while 'iF2' > 0 # Index for the position in the 15 by 22 array, to make wav file name fIndex$ = "V" + "_" + fixed$(iF1, 0) + "_" + fixed$('iF2', 0) # Calculate the second formant frequency f2=650*sinh('z2'/7) z2='z2'-'z2inc' # Keep old F2 value if new one is too close to F1 if ('f2'-'f1' < 250) f2='oldf2' endif oldf2='f2' # Calculate the second formant bandwidth b2=(38.498+0.05859*'f2') # Calculate the F3 frequency and bandwidth f3 = 2160.3 + 0.5519*'f1' + 0.13103*'f2' b3=(38.498+0.05859*'f3') # n.b. If you're using the formulae in vow_array.c (which follow # Nearey, 1989), then calculate f4 here rather than in outer loop # Calculate the F0 offset, the duration, and the duration ratio dur=(457.6 + 0.0259*'f1' - 0.03942*'f2')/1000 durRatio='dur'/0.385 f0Delta=(98.88-0.01707*'f1')-93 # Then synthesis a new source file with the right F0 contour and # duration for this cell in array of F1 and F2 values select Sound 'sourcefile$' To Manipulation... 0.01 60 120 Extract pitch tier Shift frequencies... 0 0.385 -20 Hertz select Manipulation 'sourcefile$' plus PitchTier untitled Replace pitch tier select Manipulation 'sourcefile$' Get resynthesis (PSOLA) Rename... sourceShifted select Manipulation 'sourcefile$' Remove # Create a FormantTier to use in synthesis Create FormantTier... 'fIndex$' 0 'dur' Add point... 0 'f1' 'b1' 'f2' 'b2' 'f3' 'b3' 'f4' 'b4' 4350 200 Add point... 'dur' 'f1' 'b1' 'f2' 'b2' 'f3' 'b3' 'f4' 'b4' 4350 250 # Select the FormantTier and the modified source file, and synthesize select FormantTier 'fIndex$' plus Sound sourceShifted Filter Rename... 'fIndex$' # Write the stimulus to a WAV file and then clean up select Sound 'fIndex$' Write to WAV file... 'fIndex$'.wav Remove select FormantTier 'fIndex$' plus Sound sourceShifted plus PitchTier untitled Remove # Write the file name, and formant values to the list of files fileappend 'listFile$' 'fIndex$' 'tab$' 'f1:0' 'tab$' 'f2:0' 'tab$' 'f3:0' 'tab$' 'f4:0' 'tab$' 'dur:3' 'newline$' # The next line was just to test the bandwidths # fileappend 'listFile$' "bandwidths" 'b1:0' 'tab$' 'b2:0' 'tab$' 'b3:0' 'tab$' 'b4:0' 'newline$' # Decrement the index to the F2 value for the next round of the "while" iF2 = 'iF2' - 1 endwhile # increment z1 before going on to next F1 value z1='z1'+'z1inc' endfor