Python之提取频域特征

 时间:2026-02-14 02:34:46

1、首先创建有一个Python文件,并导入库文件:

     from scipy.io import wavfile

     from python_speech_features import mfcc, logfbank

     import matplotlib.pylab as plt

2、读取音频文件:

     samplimg_freq, audio = wavfile.read("data/input_freq.wav")

Python之提取频域特征

3、提取MFCC特征和过滤器特征:

     mfcc_features = mfcc(audio, samplimg_freq)

     filterbank_features = logfbank(audio, samplimg_freq)

Python之提取频域特征

Python之提取频域特征

4、打印参数,查看可生成多少个窗体:

     print('\nMFCC:\nNumber of windows =', mfcc_features.shape[0])

     print('Length of each feature =', mfcc_features.shape[1])

     print('\nFilter bank:\nNumber of windows=', filterbank_features.shape                                                                                                                 [0])

     print('Length of each feature =', filterbank_features.shape[1])

Python之提取频域特征

5、将MFCC特征可视化。转换矩阵,使得时域是水平的:

     mfcc_features = mfcc_features.T

     plt.matshow(mfcc_features)

     plt.title('MFCC')

Python之提取频域特征

6、将滤波器组特征可视化。转化矩阵,使得时域是水平的:

     filterbank_features = filterbank_features.T

     plt.matshow(filterbank_features)

     plt.title('Filter bank')

     

     plt.show()

Python之提取频域特征

  • Matlab如何实现在文件上手写签名并有扫描件效果
  • 如何用MFC做一个简单的加法器
  • word2010中如何插入一个3乘以2矩阵
  • matlab曲线拟合怎么做?
  • Mathematica如何用拉普拉斯变换解微分方程?
  • 热门搜索
    胃胀是怎么回事 宫颈囊肿是怎么形成的 鼻子上长痘痘怎么去掉 童话故事怎么写 鼠标灵敏度怎么调 过敏性咳嗽怎么治疗 巴基斯坦为什么和中国这么好 苜蓿怎么读 bread怎么读 鸡肝怎么做好吃