-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmy_gen_logfb_feat.m
More file actions
38 lines (30 loc) · 959 Bytes
/
my_gen_logfb_feat.m
File metadata and controls
38 lines (30 loc) · 959 Bytes
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
function my_gen_logfb_feat(nbands)
% the job of this script is to take a file "~files.txt" of wav
% files 1 per line and create mfc files from them
filelistname='~allfiles.txt';
filelist = fopen(filelistname);
fname = fgetl(filelist);
numfile = 0;
NFFT=512;
fs = 16000;
H = get_mel_filterbank(26,NFFT/2,fs);
while ischar(fname)
speech = audioread(fname);
frames = frame_sig(speech,0.025*fs,0.01*fs,@(x)hamming(x));
pspec = abs(fft(frames,NFFT,2)).^2;
pspec = pspec(:,1:NFFT/2);
lfbe = log(pspec*H');
%lfbe = log(pspec);
%lfbe = frames;
[a b c] = fileparts(fname);
newname = [a,'/',b,'.mlogfb'];
% fprintf('writing "%s" %dx%d\n', newname, size(X,1), size(X,2));
write_HTK_file(lfbe,newname,10000,6);
fname = fgetl(filelist);
numfile = numfile + 1;
if mod(numfile,100) == 0
fprintf(',');
end
end
fprintf('Number of files processed (logfb) = %d\n',numfile);
fclose(filelist);