Info

This question is closed. Reopen it to edit or answer.

Can some one tell me whats wrong with this code. Its very urgent. Thank you.

1 view (last 30 days)
Speech Recognition from file
if chos==3,
clc;
[namefile,pathname]=uigetfile('*.wav;*.au','Select a new sound');
if namefile~=0
pos = strfind(namefile,'.');
ext = namefile(pos+1:end);
if strcmp(ext,'au')
[y,Fs,bits] = auread(strcat(pathname,namefile));
end
if strcmp(ext,'wav')
[y,Fs,bits] = wavread(strcat(pathname,namefile));
end
% if the input sound is not mono
if size(y,2)==2
y=y(:,1);
end
disp('Sound selected for recognition:');
message=strcat('File:',namefile);
disp(message);
message=strcat('Location:',pathname);
disp(message);
else
warndlg('Input sound must be selected.',' Warning ')
end
if (exist('sound_database.dat')==2)
load('sound_database.dat','-mat');
if (Fs ~= samplingfrequency) || (bits ~= samplingbits)
warndlg('Sampling parameters do not match with parameters already present in database',' Warning ')
else
%----- code for speech recognition -------
vettore_pesi = zeros(sound_number,1);
D1 = specgram(y,512,Fs,512,384);
disp('Database scanning...');
for ii=1:sound_number
D2 = specgram(data{ii,1},512,Fs,512,384);
SM = syms(abs(D1),abs(D2));
%[p,q,C] = dp(1-SM);
[p,q,C] = dpfast(1-SM);
peso = C(size(C,1),size(C,2));
vettore_pesi(ii) = peso;
message=strcat('Sound #',num2str(ii));
disp(message);
end
[min_value,min_index] = min(vettore_pesi);
speech_id = data{min_index,2};
%-----------------------------------------
disp('Matching sound:');
message=strcat('File:',data{min_index,4});
disp(message);
message=strcat('Location:',data{min_index,3});
disp(message);
message = strcat('Recognized speech ID: ',num2str(speech_id));
disp(message);
msgbox(message,'Matching result','help');
end
else
warndlg('Database is empty. No matching is possible.',' Warning ')
end
end

Answers (2)

Varun
Varun on 25 Apr 2014
The code is for speech recognition from file. The error is at the line SM=simmx(abs(D1),abs(D2));
If it is invalid function then what is the valid function to be used.

Walter Roberson
Walter Roberson on 25 Apr 2014
Your code does not contain that line. Your code contains a call to syms() not a call to simmx().
syms() does not return any values, and must be passed names, not values.
Your code should probably use
SM = sym([abs(D1),abs(D2)]);
Note that this requires the Symbolic Toolkit.
dpfast() does not appear to be a Mathworks supplied routine, so I have no idea why it wants a symbolic array.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!