加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

从AudioLazy库中的python中的zfilter对象中提取数值

发布时间:2020-12-16 23:53:31 所属栏目:Python 来源:网络整理
导读:我正在使用AudioLazy Library来提取一些音频功能. lpc function(线性预测编码)在时域中接收块,并返回白化LPC滤波器(ZFilter) filt = lpc(intensity,order=16) # Analysis filtergain = 1e-2 # Gain just for alignment with DFT(gain / filt).plot(min_freq=

我正在使用AudioLazy Library来提取一些音频功能.

lpc function(线性预测编码)在时域中接收块,并返回白化LPC滤波器(ZFilter)

filt = lpc(intensity,order=16) # Analysis filter
gain = 1e-2 # Gain just for alignment with DFT
(gain / filt).plot(min_freq=0,max_freq=3.141592653589793/4);

filt是一个ZFilter:

1 - 2.47585 * z^-1 + 2.68746 * z^-2 - 1.71373 * z^-3 + 0.383238 * z^-4 + 0.451183 * z^-5 - 0.480446 * z^-6 + 0.304557 * z^-7 + 0.0277818 * z^-8 - 0.280118 * z^-9 + 0.0705354 * z^-10 + 0.0217045 * z^-11 + 0.0456379 * z^-12 - 0.012231 * z^-13 + 0.00986871 * z^-14 + 0.0553664 * z^-15 - 0.0800961 * z^-16

绘图功能,返回图像:

我想从幅度曲线中提取数值(以dB为单位).你能帮助我吗?

谢谢

最佳答案
我用这几行代码解决了这个问题……现在我可以提取(并绘制:P)LPC向量.

samples=2048; #Number of samples (frequency values)
min_freq=0.; #Frequency range
max_freq=3.141592653589793/4; #Frequency range
freq_scale="linear" #Chooses whether plot is "linear" 
mag_scale="dB" #Chooses whether magnitude plot scale.
fscale = freq_scale.lower()
mscale = mag_scale.lower()
mscale = "dB"

fig = plt.figure()
Hz = 3.141592653589793 / 12.

# Sample the frequency range linearly (data scale) and get the data
freqs = list(line(samples,min_freq,max_freq,finish=True))
freqs_label = list(line(samples,min_freq / Hz,max_freq / Hz,finish=True))
data = filt.freq_response(freqs)
mag = { "dB": dB20 }[mscale]
print mag(data);

情节如下:

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读