Speech Recognition in MATLAB?

3 Ansichten (letzte 30 Tage)
Abinaya Subramaniam
Abinaya Subramaniam am 8 Jun. 2017
Kommentiert: Alex Shubin am 4 Okt. 2018
I have written a code that recognizes specific words.
Basically , if I upload an audio file and give some keyword, I want the time stamps where that keyword has been played in the audio file from MATLAB.
Any heads up on that ?
function speechrecognition(filename)
voice=wavread(filename);
x=voice;
x=x';
x=x(1,:);
x=x';
y1=wavread('one.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('two.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('three.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('four.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('one.wav'),50000)
soundsc(h,50000)
elseif m<=m2
soundsc(wavread('two.wav'),50000)
soundsc(h,50000)
elseif m<=m3
soundsc(wavread('three.wav'),50000)
soundsc(h,50000)
elseif m<=m4
soundsc(wavread('four.wav'),50000)
soundsc(h,50000)
elseif m<m5
soundsc(wavread('five.wav'),50000)
soundsc(h,50000)
else
{soundsc(wavread('denied.wav'),50000)}
end
  4 Kommentare
KSSV
KSSV am 4 Okt. 2018
How about attaching the input files also..so that we can try?
Alex Shubin
Alex Shubin am 4 Okt. 2018
Basically my task was find timestamps of one sound in long track. for example: you want separate a track by some noise or music intro you need peek that intro and script must provide you a timestamps where that sound located in track (it can be repeated a many times)
here is my current code:
function [] = untitled(inputArg2,inputArg1)
[x, Fs] = audioread(inputArg1);
[x1,Fs1] = audioread(inputArg2);
x=x';
x=x(1,:);
x=x';
x1=x1';
x1=x1(1,:);
x1=x1';
tt1 = (0:length(x)-1)/Fs;
tt2 = (0:length(x1)-1)/Fs1;
Y = fft(x);
Z = fft(x1);
subplot(3,1,1), plot(tt1,x);
subplot(3,1,2), plot(tt2,x1);
[C1,lag1] = xcorr(abs(Y),abs(Z) );
subplot(3,1,3), plot(lag1/Fs,C1);
end

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by