用于导出有关音频的所有可能数据的 Praat 脚本

Praat script to export all possible data about audio

也许有人 Praat script, which can get all possible information about the Audio file (pitches, formats, intensity)?

假设 "all possible data about audio" 你 表示基频、共振峰结构和强度轮廓(而不是光谱、脉冲等),最简单的方法这样做就是分别生成一个Pitch, Formant, and Intensity个对象。

pitch     = To Pitch: 0, min_f0, max_f0
formant   = To Formant (burg): 0,
  ... total_formants, max_formant, 0.025, 50
intensity = To Intensity: min_f0, 0, "yes"

不过,您仍需要了解有关正在处理的音频的一些 信息,例如您感兴趣的最大共振峰的可能频率,或者范围在其中你估计基本面(你可能想看看 this plugin 用自动方法估计 f0 范围)。

至于导出,我假设您的意思是您希望可以从 not Praat 的程序访问此信息。这可能是最难的部分,因为 Praat 没有任何标准的方法来 export 数据,而且它使用的数据格式虽然都是基于文本的,但都非常.. . Praat 特有的(您可以使用 Save as text file... 命令查看它们)。

您可以在 Praat 中处理它们并将您想要的数据放入 Table object with whatever format and structure you want and save it as either a tab or a comma separated file (see my related answer)。要开始使用,您可以使用可用于共振峰对象的 Down to Table... 命令,这将使用共振峰数据创建 Table。然后,您可以扩展 Table 以包含来自 Pitch 和 Intensity 对象(或您需要的任何对象)的数据。

或者,Praat 使用的大多数(=不是全部)基于文本的格式是 几乎 YAML,因此您可以尝试转换它们并阅读它们 as -is 到您以后要使用的任何程序中。我写了几个 Perl 脚本来执行此操作,将 to and from JSON/YAML, and a Praat plugin 转换为从 Praat GUI 执行此操作。你可能想检查一下。

这是解决问题的脚本。

form Give the parameters for pause analysis
   comment soundname:
    text soundname 1.wave   
   comment outputFileName.csv:
    text outputFileName result.csv
endform

min_f0 = 75
max_f0 = 350

Read from file: soundname$
soundname$ = selected$ ("Sound")

select Sound 'soundname$'
formant = To Formant (burg): 0, 4, 5000, 0.025, 50
formantStep = Get time step


selectObject: formant
table = Down to Table: "no", "yes", 6, "yes", 3, "yes", 3, "yes"
numberOfRows = Get number of rows

select Sound 'soundname$'
pitch = To Pitch: 0, min_f0, max_f0

selectObject: table
Append column: "Pitch"

for step to numberOfRows
    selectObject: table
    t = Get value: step, "time(s)"

    selectObject: pitch
    pitchValue = Get value at time: t, "Hertz", "Nearest"

    selectObject: table
    Set numeric value: step, "Pitch", pitchValue
endfor


#export to csv
selectObject: table
Save as comma-separated file: outputFileName$
removeObject(table)

echo Ok