Matching two series of Mfcc coefficients

落花浮王杯 提交于 2019-12-04 16:25:40

I had the same problem and the solution for it was to match the two arrays of MFCCs using the Dynamic Time Warping algorithm.

After computing the MFCCs you should now have, for each of your two signals, an array where each element contains the MFCCs for a frame (an array of arrays). The first step would be to compute "distances" between every one element of one array and every one element of the other, i.e. distances between every two sets of MFCCs (you could try using the Euclidian Distance for this).

This should leave you with a 2-dimensional array (let's call it "dist") where element (i,j) represents the distance between the MFCCs of the i-th frame in the first signal and the MFCCs of the j-th frame of your second signal.

On this array you can now apply the DTW algorithm:

  • dtw(1,1) = dist(1,1)
  • dtw(i,j) = min (dtw(i-1, j-1), dtw(i-1, j), dtw(i, j-1)) + dist(i,j).

The value representing the "difference" between your two files is dtw(n,m), where n = nr. of frames in the first signal, m = nr. of frames of the second one.

For further reading, this paper might give you an overall view of applying DTW to MFCCs and this presentation of the DTW algorithm might also help.

Since the two vectors are effectively histograms, you might want to try calculating the chi-squared distance between the vectors (a common distance measure for histograms).

d(i) = sum (x(i) - y(i))^2/(2 * (x(i)+y(i)));

A good (mex) implementation can be found in this toolbox:

http://www.mathworks.com/matlabcentral/fileexchange/15935-computing-pairwise-distances-and-metrics

Call as follows:

d = slmetric_pw(X, Y, 'chisq');

I faced the same problem recently. The best way I found is to use the audio library MIRtoolbox, which is very powerful in terms of audio processing.

After adding this library, the distance of two MFCCs can be easily computed by calling (lower distance <=> similar matches):

dist = mirgetdata(mirdist(mfcc1, mfcc2));
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!