-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfdlp_feat.m
74 lines (61 loc) · 2.41 KB
/
fdlp_feat.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
62
63
64
65
66
67
68
function ceps = fdlp_feat(samples,config_file)
%*****************************************************************
% Function to extract FDLP based features
% Usage OUTPUT = FDLP_FEAT(SAMPLES,CONFIG-FILE)
% Config file must contain lines in format NAME = VALUE
% Detailed information about the parameters present in README
%*****************************************************************
% Sriram Ganapathy
% Center of Language and Speech Processing
% Johns Hopkins University
%*****************************************************************
% 11-Jan-2012
% See the file COPYING for the licence associated with this software.
%*****************************************************************
if nargin < 1
error ('Unknown Input - OUTPUT = FDLP_FEAT(SAMPLES,CONFIG-FILE');
end
Time = clock ;
disp ( ' ****************************************** ' );
disp( ['FDLP Feature Extraction Invoked On ', num2str(datestr(now))]);
if nargin < 2
disp ('Using default configuration from matlab.config file');
config_file = 'matlab.config';
end
tic ;
%*****************************************************************
param = read_config_file(config_file) ;
%*****************************************************************
if max(abs(samples)) < 1
samples = samples * 2^15; % Making the samples to raw format
end
A = samples(:);
sr = param.fs;
param.flen= (param.fr_len/1000)*sr; % frame length corresponding to 25ms
param.fhop= (param.fr_shift/1000)*sr; % frame overlap corresponding to 10ms
fnum = floor((length(A)-param.flen)/param.fhop)+1;
send = (fnum-1)*param.fhop + param.flen;
A = A(1:send);
if param.fullsig
fdlpwin = send;
else
fdlpwin = param.fdlplen*sr; % FDLP window length
end
fdlpolap = ceil((param.fr_len-param.fr_shift)/10)*sr/100;
[X,add_samp] = frame_new(A,fdlpwin,fdlpolap);
ceps = [];
for i = 1 :size(X,2) % Go over each FDLP window
x = X(:,i);
% Now lets dither (make sure the original waves are not normalized!)
x = ditherit(x);
x = x - 0.97* [0 ; x(1:end-1)]; % Pre-emphasis
% FDLP processing starts here
temp = do_feats_for_seg(x,param);
ceps = [ceps temp];
end
ceps = ceps(:,1:fnum);
toc;
disp ( ['Completed ' num2str(fnum) ' feature vectors of dim ' num2str(size(ceps,1)) ...
' for a ' num2str(send/param.fs) ' sec file'])
disp ( ' ****************************************** ' );