MFCC和三种Python库中的delta系数

5

我最近在做关于MFCC的作业,但是我无法弄清楚使用这些库之间的一些区别。

我使用的三个库分别是:

python_speech_features

SpeechPy

LibROSA

samplerate = 16000
NFFT = 512
NCEPT = 13

第一部分:Mel滤波器组

temp1_fb = pyspeech.get_filterbanks(nfilt=NFILT, nfft=NFFT, samplerate=sample1)
# speechpy do not divide 2 and add 1 when initializing
temp2_fb = speechpy.feature.filterbanks(num_filter=NFILT, fftpoints=NFFT, sampling_freq=sample1)
temp3_fb = librosa.filters.mel(sr=sample1, n_fft=NFFT, n_mels=NFILT)
# fix librosa normalized version
temp3_fb /= np.max(temp3_fb, axis=-1)[:, None]

pic1

只有speechpy中的形状会得到(, 512),其他全部为(, 257)。Librosa的图形稍微有些变形。

第二部分:MFCC

# pyspeech without lifter. Using hamming
temp1_mfcc = pyspeech.mfcc(speaker1, samplerate=sample1, winlen=0.025, winstep=0.01, numcep=NCEPT, nfilt=NFILT, nfft=NFFT,
                           preemph=0.97, ceplifter=0, winfunc=np.hamming, appendEnergy=False)
# speechpy need pre-emphasized. Using rectangular window fixed. Mel filter bank is not the same
temp2_mfcc = speechpy.feature.mfcc(emphasized_speaker1, sampling_frequency=sample1, frame_length=0.025, frame_stride=0.01,
                                   num_cepstral=NCEPT, num_filters=NFILT, fft_length=NFFT)
# librosa need pre-emphasized. Using log energy. Its STFT using hanning, but its framing is not the same
temp3_energy = librosa.feature.melspectrogram(emphasized_speaker1, sr=sample1, S=temp3_pow.T, n_fft=NFFT,
                                          hop_length=frame_step, n_mels=NFILT).T
temp3_energy = np.log(temp3_energy)
temp3_mfcc = librosa.feature.mfcc(emphasized_speaker1, sr=sample1, S=temp3_energy.T, n_mfcc=13, dct_type=2, n_fft=NFFT,
                                  hop_length=frame_step).T

pic2

我已经尽力设置了公平的条件。比喻的形象变得更加深沉。

第三部分:Delta系数

temp1 = pyspeech.delta(mfcc_speaker1, 2)
temp2 = speechpy.processing.derivative_extraction(mfcc_speaker1.T, 1).T
# librosa along the frame axis
temp3 = librosa.feature.delta(mfcc_speaker1, width=5, axis=0, order=1)

pic3

我不能直接将mfcc作为speechpy的参数,否则会非常奇怪。而且这些参数原本的作用与我的预期不同。

我想知道是什么因素导致了这些差异。这只是我上面提到的问题吗?还是我犯了一些错误?希望得到详细说明,谢谢。


绘图时,我截断了第一个系数(能量)。 - Bill Sun
1个回答

2

有许多MFCC的实现方法,它们之间经常会有微小的差异 - 窗口函数形状、梅尔滤波器计算和DCT也可能不同。很难找到完全兼容的库。从长远来看,只要在所有地方使用相同的实现,这些差异就不会影响结果。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接