###################################################################### #### Robert Felty #### 2005 #### This script comes with no warranty. Use at your own risk ## this script displays measurements taken in Praat ## For example, say you have used the VowelMeasurements script to make some ## measurements, and you have the results in a tab delimited file. This script ## will open up each soundfile and display the measurements taken in a textgrid ## window, allowing one to easily double-check the measurements, and make any ## adjustments if necessary. The adjusted measurements will be written out to a ## separate file ###################################################################### ## if you need to quit halfway through and start over again, setting this will ## allow you to start where you left off startfile=1 # change dir to whatever directory the sound files are in dir$="/afs/lsa.umich.edu/group/ling/labs/phonetics/UROP/stimuli05/dan" table$ = "stimulib" Read Table from tab-separated file... 'dir$'/'table$'.txt rows = Get number of rows columns = Get number of columns for i from startfile to rows select Table 'table$' #read in values based upon header names (fname, cutstart etc.) filename$ = Get value... 'i' fname begin = Get value... 'i' cutstart end = Get value... 'i' cutend startingPoint = Get value... 'i' vowelstart endingPoint = Get value... 'i' vowelend if endingPoint=startingPoint endingPoint=endingPoint+0.10 endif midPoint = Get value... 'i' midpoint if midPoint=startingPoint midPoint=midPoint+0.05 endif comment$ = Get value... 'i' comment rating = Get value... 'i' rating if i=1 ratingm1=0 else rateindex=i-1 ratingm1 = Get value... 'rateindex' rating endif if i=rows ratingp1=0 else rateindex=i+1 ratingp1 = Get value... 'rateindex' rating endif Read from file... 'dir$'/edited/'filename$'.wav index1 = index(filename$, "/")+1 index2 = index(filename$, ".") total = length(filename$) numchar =total - index1 - (total - index2) #printline numchar = 'numchar' #printline 'index1' 'index2' #filetmp$ = mid$(filename$, index1, numchar) #printline 'filetmp$' #file$=left$(filetmp$, index2) #printline 'file$' To TextGrid... vowel vowel #Move cursor to... 'endingPoint' #Add on tier 1 #Move cursor to... 'startingPoint' #Add on tier 1 #Move cursor to... 'midPoint' #Add on tier 1 Insert point... 1 'startingPoint' start Insert point... 1 'midPoint' midpoint Insert point... 1 'endingPoint' end Insert point tier... 2 rating Insert point... 2 'midPoint' 'rating' Insert point tier... 3 comment Insert point... 3 'midPoint' 'comment$' Insert point tier... 4 joseComment Insert point... 4 'midPoint' select Sound 'filename$' Play plus TextGrid 'filename$' Edit pause make any changes, then click to see next stimulus 'ratingm1' * 'rating' * 'ratingp1' #get new start and end points select TextGrid 'filename$' vowelbegin = Get time of point... 1 1 vowelend = Get time of point... 1 3 midpoint = vowelbegin + ((vowelend - vowelbegin)/2) #get jose's comments joseComment$ = Get label of point... 4 1 #Write out to file if i=1 #write header only for first file fileappend "'dir$'/stimuliRevised.txt" fnum'tab$'fname'tab$'cutstart'tab$'cutend'tab$'rating'tab$'comment'tab$'joseComment'tab$'vowelstart'tab$'vowelend'tab$'midpoint'newline$' endif fileappend "'dir$'/stimuliRevised.txt" 'i''tab$''filename$''tab$''begin:4''tab$''end:4''tab$''rating''tab$''comment$''tab$''joseComment$''tab$' print 'vowelbegin:4''tab$''vowelend:4''tab$''midpoint:4''newline$' fileappend "'dir$'/stimuliRevised.txt" 'vowelbegin:4''tab$''vowelend:4''tab$''midpoint:4''newline$' Remove select Sound 'filename$' Remove endfor #pause next stimulus? #endfor #pause all done with this dir