-
Notifications
You must be signed in to change notification settings - Fork 0
/
EE STE ZCR.m
61 lines (51 loc) · 1.81 KB
/
EE STE ZCR.m
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
52
53
54
55
56
57
58
59
60
61
%% Definitions
clc;clear;
path='c:\data2'; fileinfo = dir(fullfile(path,'*.au')); filesnumber=size(fileinfo);
for i = 1 : filesnumber(1,1)
[signal{i} fs{i}] = audioread(fullfile(path,fileinfo(i).name));
disp(['Loading Sound No : ' num2str(i) ]);
end;
win = 0.050; step = 0.050;
%% Time domain features
% Energy Entropy
for i = 1 : filesnumber(1,1)
EnergyEntropy{i}=Energy_Entropy_Block(signal{i},win*fs{i}, step*fs{i},10)';
disp(['EnergyEntropy No : ' num2str(i) ]);end;
for i = 1 : filesnumber(1,1) % Changing range
EE{i}=EnergyEntropy{i}(1:590,1);
disp(['EnergyEntropy No : ' num2str(i) ]);end;
for i = 1 : filesnumber(1,1) % Extracted features
eefeature(i,:)=EE{i};end;
%%
% Short Time Energy
for i = 1 : filesnumber(1,1)
ShortTimeEnergy{i}=ShortTimeEnergy(signal{i},win*fs{i}, step*fs{i});
disp(['ShortTimeEnergy No : ' num2str(i) ]);end;
for i = 1 : filesnumber(1,1) % Changing range
STE{i}=ShortTimeEnergy{i}(1:590,1);
disp(['ShortTimeEnergy No : ' num2str(i) ]);end;
for i = 1 : filesnumber(1,1) % Extracted features
stefeature(i,:)=STE{i};end;
%%
% Zero Crossing Rate
for i = 1 : filesnumber(1,1)
ZeroCrossingRate{i}=zcr(signal{i},win*fs{i}, step*fs{i}, fs);
disp(['ZeroCrossingRate No : ' num2str(i) ]);end;
for i = 1 : filesnumber(1,1) % Changing extracted feature range
ZCR{i}=EnergyEntropy{i}(1:590,1);
disp(['ZeroCrossingRate No : ' num2str(i) ]);end;
for i = 1 : filesnumber(1,1) % Extracting final features
zcrfeature(i,:)=ZCR{i};end;
%% Labaling
eefinal=feature;
eefinal(1:50,591)=1;
eefinal(51:100,591)=2;
eefinal(101:150,591)=3;
stefinal=feature;
stefinal(1:50,591)=1;
stefinal(51:100,591)=2;
stefinal(101:150,591)=3;
zcrfinal=feature;
zcrfinal(1:50,591)=1;
zcrfinal(51:100,591)=2;
zcrfinal(101:150,591)=3;