Code covered by the BSD License  

Highlights from
VOCIE RECOGNITION

VOCIE RECOGNITION

by

 

08 May 2013 (Updated )

This code is very simple, using only crosscorrelation to recognize voice..

test23.m
clc;
clear all;
% PYULEAR  :  
Fs=8000;
MV=zeros(20,7); 
MI=zeros(20,7);
order = 12;
nfft = 512;
Fs = 8000;
fs=8000;
%TEST INPUT:
file=sprintf('%s.wav','test');
input('You have 2 seconds to say your name. Press enter when ready to record--> ');
    y = wavrecord(16000,8000); 
    sound(y,8000); 
    wavwrite(y,8000,file);
 
 %DC REMOVE:   
 mu=mean(y);
 y=y-mu;    

%PYULEAR FOR TEST I/P:
T=pyulear(y,order,nfft,Fs);
T=10*log10(T);
k=0;
for i = 1:140
   if i<=20
       j=1;
       k=k+1;
    file=sprintf('%s%d.wav','dn',i); %FILE NAMED dn1 TO dn20
    else if i<=40
            j=2; 
            k=i-20;
            file = sprintf('%s%d.wav','dp',i);
        else if i<=60
                j=3;
                k=i-40;
                file = sprintf('%s%d.wav','de',i);
            else if i<=80
                    j=4;
                    k=i-60;
                    file = sprintf('%s%d.wav','dv',i);
                else if i<=100
                        j=5;
                        k=i-80;
                        file = sprintf('%s%d.wav','dva',i);
                    else if i<=120
                        j=6;
                        k=i-100;
                        file = sprintf('%s%d.wav','dsa',i);
                        else 
                            j=7;
                            k=i-120;
                            file=sprintf('%s%d.wav','das',i);
                        end 
                    end
                end
            end
         end
   end
    w=wavread(file);
%PSD    
P=pyulear(w,order,nfft,Fs);
    P=10*log10(P);
    C=crosscorr(T,P);
    %figure;
    %plot(C);
    [Y,I]=max(C);
    MV(k,j)=Y;
    MI(k,j)=I;
end
MV
MI

% DETECTION : :)
ner=MV(1:20,1);
pin=MV(1:20,2);
edathu=MV(1:20,3);
valathu=MV(1:20,4);
vattam=MV(1:20,5);
sathuram=MV(1:20,6);
nill=MV(1:20,7);
a1=sum(ner)
a2=sum(pin)
a3=sum(edathu)
a4=sum(valathu)
a5=sum(vattam)
a6=sum(sathuram)
a7=sum(nill)
if a1>a2 & a1>a3 & a1>a4 & a1>a5 & a1>a6 & a1>a7
    if a1-a2<.2
        'PIN !!'
    else  
    'NER !!'
    end
else if a2>a3 & a2>a4 & a2>a1 & a2>a5 & a2>a6 & a2>a7
        'PIN !!'
    else if a3>a4 & a3>a1 & a3>a2 & a3>a5 & a3>a6 & a3>a7
            if a3-a2<.4
                'PIN !!'
            else
            'EDATHU !!'
            end
        else if a4>a3 & a4>a1 & a4>a2 & a4>a5 & a4>a6 & a4>a7
                if a4-a5<.2
                    
                      'VATTAM !!'
                else
                         'VALATHU !!'
                end
            else if a5>a3 & a5>a1 & a5>a2 & a5>a4 & a5>a6 & a5>a7
                       'VATTAM !!'
                else if a6>a3 & a6>a1 & a6>a2 & a6>a4 & a6>a5 & a6>a7 
                    
                'SATHURAM !!'
                    else
                     'ASAIYATHEY !!'
                    end
                    
                end
            end
        end
    end
end

Contact us