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

时间:2018-01-07 15:58:00

标签: praat

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

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

1 个答案:

答案 0 :(得分:2)

这是一个脚本,其中包含有关如何运行它的说明。它在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