Compare two spoken words with MFCC and DTW

16 views (last 30 days)
hanan bahtiti on 24 Jun 2020
Edited: hanan bahtiti on 26 Jun 2020
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
w=Inf;
end
ns=size(s,1);
nt=size(t,1);
if size(s,2)~=size(t,2)
error('Error in dtw(): the dimensions of the two input signals do not match.');
end
w=max(w, abs(ns-nt)); % adapt window size
%% initialization
D=zeros(ns+1,nt+1)+Inf; % cache matrix
D(1,1)=0;
%% begin dynamic programming
for i=1:ns
for j=max(i-w,1):min(i+w,nt)
oost=norm(s(i,:)-t(j,:));
D(i+1,j+1)=oost+min( [D(i,j+1), D(i+1,j), D(i,j)] );
end
end
d=D(ns+1,nt+1);