forked from yongxuUSTC/DNN-for-speech-enhancement
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathread_htk_fea.m
23 lines (17 loc) · 924 Bytes
/
read_htk_fea.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
%% ************************************************************************
% readHTK - just incase you ever want to go backwards
%**************************************************************************
function [htkdata,nframes,sampPeriod,sampSize,paramKind] = readHTK_new(filename,byte_order)
if nargin<2
byte_order = 'be';
end
fid = fopen(filename,'r',sprintf('ieee-%s',byte_order));
nframes = fread(fid,1,'int32');
sampPeriod = fread(fid,1,'int32');
sampSize = fread(fid,1,'int16');
paramKind = fread(fid,1,'int16');
% read the data
htkdata = fread(fid,nframes*(sampSize/4),'float32');
htkdata = reshape(htkdata,sampSize/4,nframes);
fclose(fid);
end % ------ OF READHTK