【问题标题】:Extract text from a Praat pitch file to another text file从 Praat 音高文件中提取文本到另一个文本文件
【发布时间】:2016-07-21 13:57:40
【问题描述】:

我想知道是否有人可以帮助我解决一个棘手的问题,即将 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 坐标的时间,那就太好了。

提前感谢您的帮助。

【问题讨论】:

    标签: contour pitch pitch-tracking praat pitch-detection


    【解决方案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。在这种情况下,唯一需要进行的操作是转置(以获得垂直表)和重命名列。

    【讨论】:

    • 谢谢 jja。这是提取时间和 F0 的好方法。我习惯于按照您的建议进行操作,但如果有一种方法可以从 Pitch 文件中提取数据,那也不错,不是吗?
    • 我不确定我明白你的意思。你的意思是不使用Praat?我个人认为这不是一个好主意,因为这些格式并不是为导出到外部应用程序而设计的。使用 Praat 解释器是最好的方法。但如果必须,可以使用正则表达式将其更改为主要符合 YAML,就像我在 praat2yaml.pl 中所做的那样。如果您愿意,我很乐意扩展答案,但我认为您可能也想在您的问题中澄清。
    • 我喜欢您的回答,并且肯定会遵循这种方式并将类似的内容集成到我的一个脚本中。我只是指出如果有方法(可能不包括使用 Praat)来处理文件并获得相同的结果也会很好。如果您有时间,我很乐意看到您上面建议的扩展。如果您没有时间,让我再次感谢您的时间和帮助。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-11-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多