# Name: pitch_at_tone.praat # Purpose: a Praat script to get the pitch and time at each tone label # Input: $basename.wav, .Pitch, .TextGrid # Output: use redirect to save the result # Date: 2005-09-01 # Author: Mafuyu Kitahara basename$ = "M024" Read from file... 'basename$'.wav resultfile$ = "'basename$'.result" Read from file... 'basename$'.Pitch Read from file... 'basename$'.TextGrid m = Get number of intervals... 1 for i to m select TextGrid 'basename$' word$ = Get label of interval... 1 i start = Get starting point... 1 i end = Get end point... 1 i n = Get number of points... 3 if word$ <> "" for j to n ### go through all points for each interval... dumb! select TextGrid 'basename$' label$ = Get label of point... 3 j time = Get time of point... 3 j if time <= end and time >= start select Pitch 'basename$' pitch = Get value at time... time Hertz Linear if pitch = undefined printline 'time:3' empty 'label$' 'word$' else printline 'time:3' 'pitch:2' 'label$' 'word$' endif endif endfor endif endfor