min dist between two utterances

min dist between two utterances

Post by sara » Fri, 19 May 2006 19:49:11


Hi I am wondering if anyone can help me with this problem. I am trying
to get the min dist between two vowels in two utterances and return the
values of the start of the vowel and the end of the vowel. I have
started the following code but need to know how to expand it ??!!

Thanks

Sara

% [b_start,b_stop]=find_sound(file_a,file_b,a_start,a_stop);
%
% Finds the point of best matching between a segment of file_a
% specified by a_start and a_stop (seconds) and a similar segment from
% file_b. Start and stop times of the segment b are returned
%
% The minim distance min_dist is also returned which is a measure of
the
% similarity of the two waveforms
%
%
function
[b_start,b_stop,min_dist]=find_sound(file_a,file_b,a_start,a_stop);



[ya,fsa]=wavread(file_a); % Read the sound a
[yb,fsb]=wavread(file_b); % Read the sound b

***
fs=fsa;

n_lpc=round(fs/1000)+3; % Number of prediction coefficients

% Compute LPC coefficients
a_lpc=lpc(a_f',n_lpc); % Signal should be in columns -> transpose
matrix
b_lpc=lpc(b_f',n_lpc); % Signal should be in columns -> transpose
matrix

nf_a=size(a_f,1); % Number of frames for signal a
nf_b=size(b_f,1); % Number of frames for signal b


final_dist=[]; % LPC distance (frame level)


time_stamps=[]; % Time for each distance
total_dist=[];

I need to extract the times now!!

Can anyone help!!!

Thanks
 
 
 

min dist between two utterances

Post by benn » Fri, 19 May 2006 19:58:06

Hi,

So you are trying to find the min dist between two vowels in two
words?? I think you have th eright idea in the code you have but to
extract the times you need to use

max_f1=nf_b-nf_a+1; % Maximum frame for signal b

for f1=1:max_f1; % Sweep on signal b at frame level
par_dist=0; % Partial distance
for f2=1:nf_a % Compute the LPC distance
a=a_lpc(f2,:);b=b_lpc(f1+f2-1,:);
par_dist=par_dist+sqrt(sum((a-b).^2)); % Euclidian distance
end
total_dist(f1)=par_dist/nf_a; % Update distance (frame level)
time_stamps(f1)=f1*ns_inc; % Update time (frame level)
end

Then to find the mindist use:

[min_dist,i]=min(total_dist); % Determine minimum distance

To get the time returned use:

b_start=time_stamps(i)/fs; % Compute the time for the minimum distance

The end time can be computed by :

b_stop=b_start+(a_stop-a_start); % Compute the end time of the segment
in file b


I hope this helps!!!

Ben

 
 
 

min dist between two utterances

Post by sara » Fri, 19 May 2006 20:04:50

Hi again,

Thank you for your quick reply!I will try that now and see if it works!


Thanks
Sara