如何在Python中绘制MFCC? [英] How to plot MFCC in Python?

查看:838
本文介绍了如何在Python中绘制MFCC?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是信号处理的初学者.到目前为止,这是我从音频文件(.WAV)中提取MFCC功能的代码:

I'm just a beginner here in signal processing. Here is my code so far on extracting MFCC feature from an audio file (.WAV):

from python_speech_features import mfcc
import scipy.io.wavfile as wav

(rate,sig) = wav.read("AudioFile.wav")
mfcc_feat = mfcc(sig,rate)

print(mfcc_feat)

我只想绘制mfcc功能以了解其外观.

I just wanted to plot the mfcc features to know what it looks like.

推荐答案

这会将MFCC绘制为颜色,这是一种更为流行的方式

This will plot the MFCC as colors, which is a more popular way

import matplotlib.pyplot as plt
import numpy as np
from matplotlib import cm
fig, ax = plt.subplots()
mfcc_data= np.swapaxes(mfcc_data, 0 ,1)
cax = ax.imshow(mfcc_data, interpolation='nearest', cmap=cm.coolwarm, origin='lower')
ax.set_title('MFCC')

plt.show()

这篇关于如何在Python中绘制MFCC?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆