赞
踩
# -*- coding:utf-8 -*-
'''
提取频域特征 --使用梅尔频率倒谱系数
'''
import numpy as np
import matplotlib.pyplot as plt
from scipy.io import wavfile
from python_speech_features import mfcc,logfbank
# 读取输入音频文件
sampling_freq,audio=wavfile.read('input_freq.wav')
# 提取mfcc和过滤器特征
mfcc_features=mfcc(audio,sampling_freq)
filter_features=logfbank(audio,sampling_freq)
# 打印参数
print '\nMFCC :\n Number of window =',mfcc_features.shape[0]
print '每个特征的长度为: ',mfcc_features.shape[1]
print '\n Filter bank: \n Number of window =',filter_features.shape[0]
print '每个特征的长度为: ',filter_features.shape[1]
# 画出特征图
mfcc_features=mfcc_features.T
plt.matshow(mfcc_features)
plt.title('MFCC')
filterbank_features=filter_features.T
plt.matshow(filter_features)
plt.title('Filter bank')
plt.show()
MFCC效果图如下:
滤波器特征图像如下:
输出结果如下:
MFCC :
Number of window = 40
每个特征的长度为: 13
Filter bank:
Number of window = 40
每个特征的长度为: 26
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。