I want to use MFCC (Mel-frequency cepstral coefficients) and DTW (dynamic time warping) algorithms to make a speech comparison script. I calculated MFCC and got 13 coefficients for each frame.

How do I calculate DWT from that? Should I discard the frames and just look at coefficents as an array. I read in this post: Speech recognition using MFCC and DTW(Dynamic Time Warping)? that you should calculate DTW between each frame, but I don't understand what I should do after I have calculated all those DTWs. If I have one audio sequence of $n$ frames and the other one of $m$ frames, then I get $n \times m$ DTW costs. And, where do I go from there.

  • 1
    $\begingroup$ You take the rightmost upper coefficient as a total distance. Or in other words, the distance that you are looking for is at the position between last frames. Usually you don't use remaining coefficients, they are just an intermediate step to obtain the final metric. $\endgroup$
    – jojek
    Mar 23, 2016 at 7:14
  • 1
    $\begingroup$ I think the following quote will help you. "In case of DTW you will be calculating the cost between each of 13 dimensional frames (simple distance metric/norm, i.e. Euclidean, Manhattan, etc.)" It is from @jojek's answer here $\endgroup$
    – Hyun Lee
    Apr 9, 2017 at 18:10

1 Answer 1


Well I think I found a solution to this, mostly by trial and error.

So what I did and its giving quite good results is : 1) If we have M(No. of frames) X N(13;No of MFCC Coefficients) matrix;

ie X=X[1 2 .....N(13) ; 1 2.....M(No of frames) ]

2) Find the DTW of [X(1;1 2 3.....M)] with the DATABASE [REF(1;1 2 3...M)] Here we are taking K=1(Not 2...12) Similarly find DTW of [X(2;1 2 3...M)] and DATABASE [REF(1;1 2 3...M)]

3) On generalizing, Find DTW of [X(k(kth MFCC coef); 1 2 3...m)];

4)So at the end we will get : K(13) values ;

5) Find the mean of these 13(K) values and let that be your Reference for deciding;

*Disclaimer: I am not certain if this is what all the papers imply, I just found it by trial and error and it gives accurate results


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.