语音信号处理笔记(python实现)[最新更新:interpolate.interp1d的使用]

2019年10月13日
近日在学习小波变换,把学习的链接贴在下面供大家查阅,之后再自己总结总结笔记看看有哪些点需要注意。
1.小波变换完美通俗讲解系列之 (一)
2.小波变换完美通俗讲解系列之 (二)
3.小波变换完美通俗讲解系列之 (三)


2019年10月27日
小波变换我觉得大家可以放放。。
真的挺难的,我最近是在想要不然就看看别人的代码调參,实用主义来了~

不过这里放一个基础的东西。关于FFT的一些细节和专业的英语词汇方便大家将中文和英文对照起来。
FFT Zero Padding


2019年10月28日
scipy.interpolate.interp1d的使用

scipy.interpolate.interp1d (x, y, kind=‘linear’, axis=-1, copy=True, bounds_error=None, fill_value=nan, assume_sorted=False)`

api中对于参数y有这么一句话:

A N-D array of real values. The length of y along the interpolation axis must be equal to the length of x.

想破脑子都不知所谓的interpolation是什么意思,但是看别人的代码,发现了这么一个问题。(sig是读取的音频)

interpolator = interpolate.interp1d(time_old, sig.T)

sig.shape
Out[37]: (1321623, 2)
time_old.shape
Out[38]: (1321623,)

自然而然的,为什么需要转置?
所以interpolation axis 到底是哪个维度呢?剧透:不转置是不行滴~~
那么怎么理解呢?

我写了如下的代码

from scipy import interpolate
import numpy as np
from matplotlib import pyplot as plt
x = np.linspace(0,10,num=1000)

y1 = np.cos(x*2*3.14)
y2 = np.sin(x*2*3.14+1)
y = np.array([y1,y2])

然后我们来看看的y1y2y的大小

y1.shape
Out[40]: (1000,)
y2.shape
Out[41]: (1000,)
y.shape
Out[42]: (2, 1000)
y[0].shape
Out[43]: (1000,)
y[1].shape
Out[44]: (1000,)

现在是不是清楚了呢?问题的根源在于我们对于numpy array的不够彻底。
插值,只能一个一个信号的进行插取。
对于多维的信号,要由第一个图分解成两个这样的图
信号要进行分解
OVER

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值