Report Parselmouth批量完整语音报告
我想知道是否有一种方法可以批量处理音频文件,并使用parselmouth或praat的另一个Python实现生成完整的语音报告。到目前为止,我只能得到中间音高,但我需要能够计算出脉冲和周期的总数,声音中断的程度和微光。如果使用python无法做到这一点,那么使用praat脚本是否也可以呢? [免责声明:我是上述Parselmouth库的作者] 这个问题是在上提出并解决的,但为了将来参考,这是我在上提出的解决方案: 之前在StackOverflow上也提出过类似的问题:,解释了如何在没有Praat“查看和编辑”窗口的情况下获取语音报告(即,使用Report Parselmouth批量完整语音报告,report,batch-processing,voice,praat,Report,Batch Processing,Voice,Praat,我想知道是否有一种方法可以批量处理音频文件,并使用parselmouth或praat的另一个Python实现生成完整的语音报告。到目前为止,我只能得到中间音高,但我需要能够计算出脉冲和周期的总数,声音中断的程度和微光。如果使用python无法做到这一点,那么使用praat脚本是否也可以呢? [免责声明:我是上述Parselmouth库的作者] 这个问题是在上提出并解决的,但为了将来参考,这是我在上提出的解决方案: 之前在StackOverflow上也提出过类似的问题:,解释了如何在没有Praat
声音
,音调
,以及点处理
对象)
首先,你得到这三个物体,声音,音高,和点处理脉冲,可能改变你想要的不同参数:
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)")
之后,您可以通过不同的方式查询要提取的不同数量。例如,PointProcess中的脉冲数可通过以下方式提取:
n_pulses = parselmouth.praat.call(pulses, "Get number of points")
其他人:
n_periods = parselmouth.praat.call(pulses, "Get number of periods", 0.0, 0.0, 0.0001, 0.02, 1.3)
shimmer_local = parselmouth.praat.call([sound, pulses], "Get shimmer (local)...", 0.0, 0.0, 0.0001, 0.02, 1.3, 1.6)
从某种程度上说,获得声音中断的程度更难。不知道为什么普拉特没有得到这个命令
在Python中实现这一点的快速方法是:
max_voiced_period = 0.02 # This is the "longest period" parameter in some of the other queries
periods = [parselmouth.praat.call(pulses, "Get time from index", i+1) -
parselmouth.praat.call(pulses, "Get time from index", i)
for i in range(1, n_pulses)]
语音中断次数=总和(如果周期>最大语音周期,则周期中周期的周期)/sound.duration
您还可以在“Voice report”的输出字符串中找到报告此百分比的行;看
如果你看一下Praat的用户界面,确实没有“获取中间值”按钮,这就是为什么这条线不起作用的原因。然而,Praat中有一个“获取分位数”命令
所以我建议
parselmouth.praat.call(pitch, "Get quantile", 0.0, 0.0, 0.5, "Hertz")
(0.5是50%分位数,即中位数)
[免责声明:我是上述Parselmouth库的作者]
这个问题是在上提出并解决的,但为了将来参考,这是我在上提出的解决方案:
之前在StackOverflow上也提出过类似的问题:,解释了如何在没有Praat“查看和编辑”窗口的情况下获取语音报告(即,使用声音
,音调
,以及点处理
对象)
首先,你得到这三个物体,声音,音高,和点处理脉冲,可能改变你想要的不同参数:
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)")
之后,您可以通过不同的方式查询要提取的不同数量。例如,PointProcess中的脉冲数可通过以下方式提取:
n_pulses = parselmouth.praat.call(pulses, "Get number of points")
其他人:
n_periods = parselmouth.praat.call(pulses, "Get number of periods", 0.0, 0.0, 0.0001, 0.02, 1.3)
shimmer_local = parselmouth.praat.call([sound, pulses], "Get shimmer (local)...", 0.0, 0.0, 0.0001, 0.02, 1.3, 1.6)
从某种程度上说,获得声音中断的程度更难。不知道为什么普拉特没有得到这个命令
在Python中实现这一点的快速方法是:
max_voiced_period = 0.02 # This is the "longest period" parameter in some of the other queries
periods = [parselmouth.praat.call(pulses, "Get time from index", i+1) -
parselmouth.praat.call(pulses, "Get time from index", i)
for i in range(1, n_pulses)]
语音中断次数=总和(如果周期>最大语音周期,则周期中周期的周期)/sound.duration
您还可以在“Voice report”的输出字符串中找到报告此百分比的行;看
如果你看一下Praat的用户界面,确实没有“获取中间值”按钮,这就是为什么这条线不起作用的原因。然而,Praat中有一个“获取分位数”命令
所以我建议
parselmouth.praat.call(pitch, "Get quantile", 0.0, 0.0, 0.5, "Hertz")
(0.5是50%分位数,即中位数)
我不明白为什么我用parselmouth和praat得到不同的数字。@keramat,确实,你不应该。您正在查询什么值,以及如何查询(在Praat和Parselmouth中)?您使用的是哪个版本的Praat(Praat以及
parselmouth.Praat_版本
)?谢谢,这是由于一些参数的差异。好的,这很有意义:-)谢谢您解决了这个问题,让我放心!我不明白为什么我用parselmouth和praat得到不同的数字。@keramat,确实,你不应该。您正在查询什么值,以及如何查询(在Praat和Parselmouth中)?您使用的是哪个版本的Praat(Praat以及parselmouth.Praat_版本
)?谢谢,这是由于一些参数的差异。好的,这很有意义:-)谢谢您解决了这个问题,让我放心!