Praat 脚本:如何提取每个音节的最大音高?

Praat scripting: How to extract max of pitch for every syllable?

我想提取每个音节的最大音高。 我有一段代码,但它抛出一个错误:

writeInfoLine: ""

selectObject: "TextGrid example", "Pitch example"

# syllable tier is 1 
number = Get number of intervals: 1
for i from 1 to number
name$ = Get label of interval: 1, i
start_time = Get start time of interval: 1, i
end_time = Get end time of interval: 1, i
max_pitch = Get maximum: start_time, end_time, "Hertz", "Parabolic"
appendInfoLine: name$, "      ", max_pitch
endfor

这是一个脚本,其中包含有关如何 运行 它的说明。它在您的 TextGrid 和 Pitch 对象之间来回跳转。

# open your wav file and textgrid into objects window
# select wav file
# run script

clearinfo

objName$ = selected$ ("Sound")
To Pitch: 0, 75, 600

select TextGrid 'objName$'
intervals = Get number of intervals: 1

printline 'intervals' intervals in textgrid

for i from 1 to intervals
 # need var$ because it's a string
 lab$ = Get label of interval: 1, i
 start = Get start time of interval: 1, i
 end = Get end time of interval: 1, i
 # now look at the Intensity object
 select Pitch 'objName$'
 max = Get maximum: start, end, "Hertz", "Parabolic"
 printline 'start' 'end' 'lab$' 'max'
 # reset for next iteration
 select TextGrid 'objName$'
endfor