在多數(shù)的現(xiàn)代語(yǔ)音識(shí)別系統(tǒng)中,人們都會(huì)用到頻域特征。梅爾頻率倒譜系數(shù)(MFCC),首先計(jì)算信號(hào)的功率譜,然后用濾波器和離散余弦變換的變換來(lái)提取特征。本文重點(diǎn)介紹如何提取MFCC特征。
首先創(chuàng)建有一個(gè)Python文件,并導(dǎo)入庫(kù)文件:? ? ?from scipy.io import wavfile? ? ?from python_speech_features import mfcc, logfbank? ? ?import matplotlib.pylab as plt1、首先創(chuàng)建有一個(gè)Python文件,并導(dǎo)入庫(kù)文件:? ? ?from scipy.io import wavfile? ? ?from python_speech_features import mfcc, logfbank? ? ?import matplotlib.pylab as plt
讀取音頻文件:
samplimg_freq, audio = wavfile.read("data/input_freq.wav")
提取MFCC特征和過(guò)濾器特征:
?????mfcc_features = mfcc(audio, samplimg_freq)
? ? ?filterbank_features = logfbank(audio, samplimg_freq)
打印參數(shù),查看可生成多少個(gè)窗體:
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])
將MFCC特征可視化。轉(zhuǎn)換矩陣,使得時(shí)域是水平的:
mfcc_features = mfcc_features.T plt.matshow(mfcc_features) plt.title('MFCC')
將濾波器組特征可視化。轉(zhuǎn)化矩陣,使得時(shí)域是水平的:
filterbank_features = filterbank_features.T plt.matshow(filterbank_features) plt.title('Filter bank') plt.show()
更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號(hào)聯(lián)系: 360901061
您的支持是博主寫(xiě)作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對(duì)您有幫助就好】元
