【发布时间】:2016-02-04 15:05:19
【问题描述】:
也许有人拥有Praat 脚本,它可以获取有关音频文件的所有可能信息(音高、格式、强度)?。
【问题讨论】:
标签: praat
也许有人拥有Praat 脚本,它可以获取有关音频文件的所有可能信息(音高、格式、强度)?。
【问题讨论】:
标签: praat
假设“所有可能的音频数据”仅是指基频、共振峰结构和强度轮廓(而不是频谱、脉冲等),这是最简单的方法就是分别生成一个Pitch、Formant和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 范围)。
至于导出,我假设你的意思是你希望这个信息可以从一个 非 Praat 的程序中访问。这可能是最难的部分,因为 Praat 没有任何导出数据的标准方法,而且它使用的数据格式虽然都是基于文本的,但都非常... Praat-具体(您可以使用Save as text file... 命令查看它们)。
您可以在 Praat 中处理它们并将您想要的数据放入 Table 对象中,使用您想要的任何格式和结构,并将其保存为制表符或逗号分隔的文件(请参阅我的 related answer)。首先,您可以使用可用于共振峰对象的Down to Table... 命令,该命令将使用共振峰数据创建一个表。然后,您可以扩展该表以包含来自 Pitch 和 Intensity 对象(或您需要的任何对象)的数据。
另外,Praat 使用的大多数(=不是全部)基于文本的格式几乎是 YAML,因此您可以尝试将它们转换并按原样读入您以后想使用的任何程序。我编写了几个执行此操作的 Perl 脚本,将 to 和 from JSON/YAML 和 a Praat plugin 转换为从 Praat GUI 执行此操作。你可能想看看这些。
【讨论】:
Down to Table... 命令可以为您提供一个开始使用的表格;我会把它添加到我的答案中。
这是一个解决问题的脚本。
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
【讨论】: