我想知道是否有人可以帮助我解决一个棘手的问题,即将一个Praat Pitch轮廓的时间和频率提取到txt文件。
我从
开始File type = "ooTextFile"
Object class = "Pitch 1"
xmin = 0
xmax = 1.592
nx = 159
dx = 0.01
x1 = 0.006002267573695814
ceiling = 1900
maxnCandidates = 2
frame []:
frame [1]:
intensity = 0
nCandidates = 1
candidate []:
candidate [1]:
frequency = 0
strength = 0.9
frame [2]:
intensity = 0
nCandidates = 1
candidate []:
candidate [1]:
frequency = 0
strength = 0.9
frame [3]:
intensity = 0
nCandidates = 1
candidate []:
candidate [1]:
frequency = 763.0480724135344
strength = 0.9
frame [4]:
intensity = 0
nCandidates = 1
candidate []:
candidate [1]:
frequency = 763.3612753914916
strength = 0.9
....
我想去:
0,0
t1,0
t2,763.0480724135344
t3,763.3612753914916
....
tn, ...
如果脚本可以读取" dx ="中的信息也会很棒。并计算x坐标的时间。
提前感谢您的帮助。
答案 0 :(得分:1)
我一直在研究一些程序来快速将不同的对象类型转换为它们的表示,而Pitch
对象相对简单。试试这个:
# Execute this with your Pitch object selected
@pitchToTable()
procedure pitchToTable ()
.obj = selected("Pitch")
.name$ = extractWord$(selected$(), " ")
.t1 = Get time from frame number: 1
.m1 = To Matrix
.m2 = Transpose
.tor = To TableOfReal
.id = To Table: "Time"
Set column label (index): 2, "F0"
Formula: "Time", "'.t1' + (Object_'.obj'.dx * (row - 1))"
Formula: "F0", "if self then self else undefined fi"
Rename: .name$ + "_pitch"
removeObject: .m1, .m2, .tor
endproc
转换利用了大多数Praat对象可以转换为Matrix对象的事实,该对象基本上已经是一个Table。在这种情况下,唯一需要进行的操作是转置(具有垂直表),并重命名列。