I used following code for speech recognize. but it says Error using wavread (line 167). Not a WAVE file, when I run the speechrecognition('one1.wav') code in command window. one1.wav is my audio wav file. what should I do for this.
2 views (last 30 days)
Show older comments
function speechrecognition(filename)
%Speech Recognition Using Correlation Method
%Write Following Command On Command Window
%speechrecognition('test.wav')
voice=wavread(filename);
x=voice;
x=x';
x=x(1,:);
x=x';
y1=wavread('one1.wav');
y1=y1';
y1=y1(1,:);
y1=y1';
z1=xcorr(x,y1);
m1=max(z1);
l1=length(z1);
t1=-((l1-1)/2):1:((l1-1)/2);
t1=t1';
%subplot(3,2,1);
plot(t1,z1);
y2=wavread('two1.wav');
y2=y2';
y2=y2(1,:);
y2=y2';
z2=xcorr(x,y2);
m2=max(z2);
l2=length(z2);
t2=-((l2-1)/2):1:((l2-1)/2);
t2=t2';
%subplot(3,2,2);
figure
plot(t2,z2);
y3=wavread('equals1.wav');
y3=y3';
y3=y3(1,:);
y3=y3';
z3=xcorr(x,y3);
m3=max(z3);
l3=length(z3);
t3=-((l3-1)/2):1:((l3-1)/2);
t3=t3';
%subplot(3,2,3);
figure
plot(t3,z3);
y4=wavread('plus1.wav');
y4=y4';
y4=y4(1,:);
y4=y4';
z4=xcorr(x,y4);
m4=max(z4);
l4=length(z4);
t4=-((l4-1)/2):1:((l4-1)/2);
t4=t4';
%subplot(3,2,4);
figure
plot(t4,z4);
y5=wavread('five.wav');
y5=y5';
y5=y5(1,:);
y5=y5';
z5=xcorr(x,y5);
m5=max(z5);
l5=length(z5);
t5=-((l5-1)/2):1:((l5-1)/2);
t5=t5';
%subplot(3,2,5);
figure
plot(t5,z5);
m6=300;
a=[m1 m2 m3 m4 m5 m6];
m=max(a);
h=wavread('allow.wav');
if m<=m1
soundsc(wavread('one1.wav'),50000)
soundsc(h,50000)
elseif m<=m2
soundsc(wavread('two1.wav'),50000)
soundsc(h,50000)
elseif m<=m3
soundsc(wavread('equals1.wav'),50000)
soundsc(h,50000)
elseif m<=m4
soundsc(wavread('plus1.wav'),50000)
soundsc(h,50000)
elseif m<m5
soundsc(wavread('five.wav'),50000)
soundsc(h,50000)
else soundsc(wavread('denied.wav'),50000)
end
2 Comments
Walter Roberson
on 16 Jul 2017
Please attach your .wav files
Also, which MATLAB version are you using, and which operating system?
Note: wavread() was removed from MATLAB a couple of releases ago; you should be using audioread()
Answers (0)
See Also
Categories
Find more on Audio and Video Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!