1

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

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
4

1 回答 1

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
于 2018-06-05T02:52:03.443 回答