0001 function [mfcc, info]=feaRead(feaFile, plotOpt)
0002
0003
0004
0005
0006
0007 if nargin<1, selfdemo; return; end
0008 if nargin<2, plotOpt=0; end
0009
0010 fid=fopen(feaFile, 'r');
0011 info.frameNum=fread(fid, 1, 'int32');
0012 info.samplePeriod=fread(fid, 1, 'int32');
0013 info.sampleBytes=fread(fid, 1, 'int16');
0014 info.paramKind=fread(fid, 1, 'int16');
0015 info.feaDim=info.sampleBytes/4;
0016 mfcc0=fread(fid, inf, 'float32');
0017 mfcc=reshape(mfcc0, info.feaDim, length(mfcc0)/info.feaDim);
0018 fclose(fid);
0019
0020 if plotOpt
0021 mesh(mfcc);
0022 box on; rotate3d on
0023 end
0024
0025
0026 function selfdemo
0027 feaFile='主人下馬客在船.fea';
0028 [mfcc, info]=feaRead(feaFile, 1);
0029 fprintf('info.frameNum = %d\n', info.frameNum);
0030 fprintf('info.samplePeriod = %d\n', info.samplePeriod);
0031 fprintf('info.sampleBytes = %d\n', info.sampleBytes);
0032 fprintf('info.paramKind = %d\n', info.paramKind);