100% found this document useful (1 vote)
378 views

Voice Recognition Project DSP On Matlab

This document describes a lab experiment on speech recognition in MATLAB using correlation. The objective is to recognize recorded words for applications like voice control. The methodology records audio files for words and tests them using cross-correlation to find similarity. Code is provided to calculate correlation between a test file and samples, then play the matching file or a failure file. Results show the system can recognize words and deny unauthorized access. However, the conclusion notes speech recognition still cannot match human ability and reliability for security applications.

Uploaded by

Nasheed Ahmed
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
378 views

Voice Recognition Project DSP On Matlab

This document describes a lab experiment on speech recognition in MATLAB using correlation. The objective is to recognize recorded words for applications like voice control. The methodology records audio files for words and tests them using cross-correlation to find similarity. Code is provided to calculate correlation between a test file and samples, then play the matching file or a failure file. Results show the system can recognize words and deny unauthorized access. However, the conclusion notes speech recognition still cannot match human ability and reliability for security applications.

Uploaded by

Nasheed Ahmed
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

DIGITAL SIGNAL PROCESSING [EE-322] Lab # 07

OPEN ENDED LAB

LABORATORY EXERCISE # 07

Name: Muhammad Jawwad_ Roll No:2018-EE-011

Speech Recognition in MATLAB using Correlation


1. Objective:
Speech Recognition in MATLAB using Correlation.
2. Hardware/Software required:
 MATLAB

3. Description:
Speech recognition is used in almost every security project where you need to speak and
tell your password to computer and is also used for automation. For example, I want to
turn my AC on or off using voice commands then I have to use Speech Recognition. I
have to make the system recognize that whether I am saying ON or OFF. In short, speech
recognition plays a vital role in voice control projects. In this Lab, I will demonstrate
Speech Recognition in Matlab and the technique I have used in this project is known as
cross correlation.

Correlation is normally used in signal processing, where you need to compare two
signals and need to find the similarity between them. It is also known as the dot product
of those two signals. Correlation is also used for pattern recognition like you want to find
some pattern in the signal then you can use Correlation. Anyways, in this project we are
using correlation to find similarity between our stored signals and the testing signal. So,
let's get started with Speech Recognition in MATLAB using Correlation.

4. Methodology:
 First of all, we recorded nine audio wav files.
 Five of them are the recorded sounds which are already feed in the MATLAB.
 Two are test files which will be recognized by the code.
 The remaining two are success and failure files which will run if you got the
recognition or not.
 First of all, what we need to do is to upload the first five training audio files in the
software so and then we need to test these fives files with the test files and we need to
check which one is a maximum match.

Now let’s move to Coding:

ELECTRONIC ENGINEERING DEPARTMENT


01
DIGITAL SIGNAL PROCESSING [EE-322] Lab # 07

Coding:

function speechrecognition(filename)
%Speech Recognition Using Correlation Method
%speechrecognition('test.wav')
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';

ELECTRONIC ENGINEERING DEPARTMENT


01
DIGITAL SIGNAL PROCESSING [EE-322] Lab # 07

%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

ELECTRONIC ENGINEERING DEPARTMENT


01
DIGITAL SIGNAL PROCESSING [EE-322] Lab # 07

5. Observation:
 Now if you read the code from start then you can see, first of all, I uploaded the
test file which I want to compare with my samples.
 After that I uploaded all the 5 samples and also get their correlation with the test
sample.
 Finally, at the end I compared the results and on the basis of it I figured out
which one is correct speech file.
 You will also get spectrum graphs of your sound files as shown in below figure:

ELECTRONIC ENGINEERING DEPARTMENT


01
DIGITAL SIGNAL PROCESSING [EE-322] Lab # 07

6. Results and Discussions:


As first we will run test.wav file check either it’s recognizing or not:

On test file speechrecognition('test.wav') we save recorded Audio of two when audio played
‘two’ after this help of correlation we will get spectrum graph of ‘two’.

Now let’s test speechrecognition('one.wav')

ELECTRONIC ENGINEERING DEPARTMENT


01
DIGITAL SIGNAL PROCESSING [EE-322] Lab # 07

Now let’s play file which we conditioned ‘denied’:


speechrecognition('ring01.wav')

As speechrecognition('ring01.wav') is not defined so after running this we will get access denied
from output.

7. Conclusion:

Finally, the conclusion can be proposed that the system can work with different Audio and if
system doesn’t recognized voice so it denied the Access. Although the speech recognition
technology has achieved many research achievements in the past ten years, many
applications has surrounded in people’s daily life and speech recognition systems have been
researched over several decades and have numerous applications, they still cannot match the
perfect performance of a human recognition system and as well as not reliable sufficiently to
be considered as a standalone security
system.

Teacher Sign: ______________

ELECTRONIC ENGINEERING DEPARTMENT


01

You might also like