Python audioop.rms()从功率到幅度的值?

时间:2017-04-12 17:57:46

标签: python python-3.x audio physics wav

我的目标是比较声级计( dB SPL )的振幅测量值与同时录制的音频片段。

audio recording system diagram

我一直在使用audioop.rms()来总结wav音频片段。

我编写了一个快速功能,可以将原始样本功率转换为分贝满量程:

def valueDBFS(value, sampleWidth):

    # use the sample width to look up the appropriate maximum sample size
    lookupBitDepth = {3: 8388607 , 2: 32768}

    return 10*np.log10(abs(value)/lookupBitDepth[sampleWidth])

Unfortunately the resulting ratio of powers is proportional to the square of Sound Pressure Level, a ratio of amplitudes

我可以通过取 dBFS 的平方根来解决问题,但单位会变得完全神秘。我更倾向于使用众所周知的相对比例来产生仪器之间的线性比较。

问题:

  1. 是否有使用audioop.rms()的替代方法 我可以总结一下wav文件的压力幅度?

  2. 或者,有没有办法修改我的功能 将均方根功率值转换为压力并以众所周知的分贝标度返回?

0 个答案:

没有答案