我一直在用Praat做音频分析。但是,我发现一些库在Python中使用Praat,并且希望这样做。在
这个网站提供了很多可以在使用praat时提取的功能。我遵循了在python中“集成”它的说明。http://homepage.univie.ac.at/christian.herbst//python/index.html 但是,我不能让它工作。它返回错误:\ OSError:[Errno 2]没有这样的文件或目录
我还发现了另一个库:https://pypi.python.org/pypi/python-praat-scripts。这也会返回错误(当我运行下面的代码时):OSError:[Errno 13]Permission denied
from praatinterface import PraatLoader
pl = PraatLoader(praatpath ='/Users/user/Downloads/praat6015_mac64.dmg')
text = pl.run_script('formants.praat', 'sample.wav', 5, 5500)
formants = pl.read_praat_out(text)
如果有人能帮助我将praat正确地集成到python中,那就太好了。谢谢。在
我没有使用过您的任何工具,但问题可能出在您的
praatpath
变量上。在您链接到的页面中,它们应该指向Praat二进制文件,而在您的示例中,它们指向的是64位Mac版本的Praat归档文件。在你必须先安装Praat。说明书相当标准,但引自Praat网站:
完成后,
praatpath
变量应该指向这个可执行文件。在这适用于您的第二个示例,但我怀疑第一个示例的问题可能类似(即它不知道Praat在哪里,因为它要么没有安装,要么没有在
PATH
中安装)。在[免责声明:我是上述Parselmouth库的作者]
如果您不介意尝试另一个库,Parselmouth将Praat集成到Python中,而不需要外部Praat二进制文件:
^{pr2}$resulting_objects
变量将包含所选Praat对象的列表,因此如果您确保选择Formant
对象,则将返回该对象。或者,如果要捕获输出窗口,请运行另一种选择是从Python本身调用分析,然后执行如下操作:
相关问题 更多 >
编程相关推荐