【问题标题】:Parselmouth batch full voice reportParselmouth 批量全语音报告
【发布时间】:2022-05-12 19:10:02
【问题描述】:

我想知道是否有一种方法可以批量处理音频文件并使用 parselmouth 或其他 pythonic 实现的 praat 生成完整的语音报告。到目前为止,我只能获得中间音高,但我需要能够计算出脉冲和周期的总数、声音中断的程度和微光。如果使用 python 无法做到这一点,是否可以使用 praat 脚本? praat generated voice report

【问题讨论】:

    标签: report batch-processing voice praat


    【解决方案1】:

    [免责声明:我是上述 Parselmouth 库的作者]

    Gitter chatbox for Parselmouth 上提出并解决了这个问题,但为了将来参考,这是我在那里建议的解决方案:

    之前在 StackOverflow 上提出过类似的问题:How to automate voice reports for Praat,解释了如何在没有 Praat“查看和编辑”窗口的情况下获取语音报告(即,使用 SoundPitchPointProcess 对象)。

    所以首先你得到这三个对象,Sound sound、Pitch pitch 和 PointProcess 脉冲,可能会改变你想要不同的参数:

    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)
    

    获得语音中断的程度有点困难。不知道为什么 Praat 没有命令得到这个。

    在 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)]
    degree_of_voice_breaks = sum(period for period in periods if period > max_voiced_period) / sound.duration
    

    您还可以在“语音报告”的输出字符串中找到报告此百分比的行;见https://stackoverflow.com/a/51657044/2043407

    如果您查看 Praat 用户界面,确实没有“获取中位数”按钮,这就是该行不起作用的原因。但是,Praat 中有一个“获取分位数”命令 所以我建议

    parselmouth.praat.call(pitch, "Get quantile", 0.0, 0.0, 0.5, "Hertz")
    

    (那 0.5 就是 50% 的分位数,即中位数)

    【讨论】:

    • 我很困惑为什么我使用 parselmouth 和 praat 得到不同的数字。
    • @keramat,确实,您不应该这样做。你在查询什么价值,以及如何(在普拉特和蛇佬腔)?您使用的是哪个版本的 Praat(Praat 和 parselmouth.PRAAT_VERSION)?
    • 谢谢,这是由于一些参数的差异。
    • 好的,有道理 :-) 感谢您解决这个问题并让我放心!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多