Processing of the speech signal is done using Matlab. I want to use MFCC (Mel-frequency cepstral coefficients) is implemented using HTK and DTW (dynamic time warping v2.1) algorithms to make a speech comparison script. I calculated MFCC and got 13 coefficients for each frame.

  1. How do I calculate DWT from Applying DTW on MFCC frames?
  2. DTW gives me a distance between two patterns. How do I determine if they match or not?

How do I edit this code? this is the code I am using:

function d=dtw(s,t,w)

% s: signal 1, size is ns*k, row for time, colume for channel
% t: signal 2, size is nt*k, row for time, colume for channel
% w: window parameter
% if s(i) is matched with t(j) then |i-j|<=w

if nargin<3


if size(s,2)~=size(t,2)
    error('Error in dtw(): the dimensions of the two input signals do not match.');

w=max(w, abs(ns-nt)); % adapt window size

%% initialization

D=zeros(ns+1,nt+1)+Inf; % cache matrix

%% begin dynamic programming

for i=1:ns

for j=max(i-w,1):min(i+w,nt)


    D(i+1,j+1)=oost+min( [D(i,j+1), D(i+1,j), D(i,j)] ); 



  • $\begingroup$ Does this answer and links in it help you? In a nutshell, for DTW you need to have a "database" of exemplars for each of the words and then determine which exemplar is closest to your utterance. Of course, this can be improved e.g. by using k-NN algorithms, etc. $\endgroup$ – jojek Jul 15 '20 at 10:09

Your Answer

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

Browse other questions tagged or ask your own question.