-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathVoiceTesting.m
More file actions
51 lines (50 loc) · 1.01 KB
/
VoiceTesting.m
File metadata and controls
51 lines (50 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
clear all;
close all;
clc;
%% Input for testing
name=input('Whose file do you want to run? Enter name: ','s')
file=strcat('E:\6thSem\dsp\VoiceRecognition\test\',name,'.wav');
b=audioread(file);
%% Feature Extraction
FE=VoiceFeatures(b);
%% Classify
load database
D=[];
for(i=1:size(F,1))%returns the length of 1st dimension of F
d=sum(abs(F(i)-FE));
D=[D d];
end
%% Smallest distance
sm=inf;
ind=-1;
for(i=1:length(D))
if(D(i)<sm)
sm=D(i);
ind=i;
end
end
%% Output
file_number=FN(ind);
sc=strcat('The file number of ', name, ' in training is: ');
disp(sc)
file_number
%% Plotting
%test file
[t,x]=audioread(file);
subplot(2,1,1)
plot(abs(t(:,1)))
xlabel('Time')
ylabel('Amplitude')
title('TEST')
%train file
subplot(2,1,2)
filet=strcat('E:\6thSem\dsp\VoiceRecognition\train\a',num2str(file_number), '.wav');
[v,s]=audioread(filet);
plot(abs(v(:,1)))
xlabel('Time')
ylabel('Amplitude')
title('TRAIN')
%Pitch
figure(2);
plot(real(fft(v)))
title('PITCH')