问题描述
有没有办法为 Praat 自动生成语音报告(在查看和编辑"窗口中的脉冲"下),因为我必须为 100 多个文件执行此操作.我需要整个文件的语音报告,并且最好在 Python 中执行此操作,因为我对此很熟悉.
Is there a way to automate the generation of a voice report (under 'Pulses' in the View & Edit window) for Praat as I have to do this for over 100 files. I need the voice report for the whole file and would ideally do this in Python as I am familiar with that.
推荐答案
[免责声明:我是提到的 Parselmouth 库的作者]
根据您的实际目标,您似乎可以在 Sound 编辑器菜单(使用 View & Edit
打开)之外获得相同的语音报告"输出:选择一个 Sound 对象,分析其音高(选择Sound
,点击Analyseperiodity > To Pitch...
)和脉冲(选择Sound
和Pitch
code> 对象,单击 To PointProcess (cc)
).之后,选择所有 3 个对象(Sound
、Pitch
、PointProcess
)和动作 Voice report...
允许你得到输出.
Depending on your actual goal, it seems you can get the same 'Voice report' output outside of the Sound editor menu (opened with View & Edit
): select a Sound object, analyze its pitch (select Sound
, click Analyse periodicity > To Pitch...
), and pulses (select Sound
and Pitch
objects, click To PointProcess (cc)
). Afterwards, selecting all 3 objects (Sound
, Pitch
, PointProcess
) and the action Voice report...
will allow you to get the output.
这甚至适用于 Praat 的批处理版本(即,没有图形用户界面).我不是编写 Praat 脚本的专家,但转换此工作流程似乎相当简单.
This works even in a batch version of Praat (i.e., without graphical user interface). I am no expert in writing Praat scripts, but converting this workflow seems reasonably straightforward.
至于您问题的另一部分:使用 Parselmouth 实际上可以使用 Python图书馆.这是我一直在创建的一个开源库,它允许以 Python 直观的方式从 Python 访问 Praat:
As for the other part of your question: doing this is Python is actually possible with the Parselmouth library. This is an open-source library I have been creating that allows accessing Praat from Python in a Python-intuitive way:
import parselmouth
sound = parselmouth.Sound("the_north_wind_and_the_sun.wav")
pitch = sound.to_pitch()
pulses = parselmouth.praat.call([sound, pitch], "To PointProcess (cc)")
voice_report_str = parselmouth.praat.call([sound, pitch, pulses], "Voice report", 0.0, 0.0, 75, 600, 1.3, 1.6, 0.03, 0.45)
对于某些对象上存在 Python 方法,对于某些其他功能,您需要使用 parselmouth.praat.call
直到在库上完成更多工作.但它适用于 Python.
For some things a Python methods exist on the objects, for some other functionality you'll need to use parselmouth.praat.call
until more work gets done on the library. But it works from Python.
但是,如果您只对语音报告的一部分感兴趣并希望将这些作为实际的数字变量(例如,因为您想对所有 100 个文件运行一些统计数据?),则可以访问所有这些内容独立于 语音报告
功能.例如,只获取某个声音文件的平均音高作为 Python float
:
However, if you are interested in only a part of the voice report and want to get these as actual numeric variables (for example because you want to run some stats on all 100 files?), all of these things can be accessed independently from the Voice report
functionality. E.g., to only get the mean pitch of a certain sound file as Python float
:
mean_pitch = parselmouth.praat.call(pitch, "Get mean", 0.0, 0.0, "Hertz")
这篇关于如何为 Praat 自动进行语音报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!