Feature Definition and Computation

Next we define the feature chains, as explained in Section 14.4.2. In mrhmm_test1.m, we create either AR or MFCC features, depending on the flag use_ar. The AR features were explained in section 10.4.10 and the MFCC features were explained in section 11.2. Note that for MFCC, the model order Ls(i) is proportional to the segment size.
% define feature module function calls and inversion calls -
% each set of calls must assume input data is in 'x' and
% outpus are 'z' and 'jout'
if(use_ar),
    E0=1;
    exact_ar=0;
    for i=1:nfeat,
        func_str{i}{1}=['E0=' num2str(E0) ';']; 
        func_str{i}{2}=['P=' num2str(Ps(i)) ';'];
        func_str{i}{3}=['exar=' num2str(exact_ar) ';'];
        func_str{i}{4}='[a,jout]=module_ar_mlx(x,0,P,E0,exar);';
        func_str{i}{5}='[k,jout]=module_ar2rc(a,jout);';
        func_str{i}{6}='[z,jout]=module_bilinear(k,jout);';
        
        inv_str{i}{1}=['E0=' num2str(E0) ';'];
        inv_str{i}{2}=['N=' num2str(Ns(i)) ';'];
        inv_str{i}{3}='k=module_bilinear_synth(z);';
        inv_str{i}{4}='r=module_acf2rc_synth(k,E0);';
        inv_str{i}{5}='y=module_acf_synth(r,N);';
        inv_str{i}{6}='x=module_dftmsq_synth(y,N);';
    end;
else, 
    % MFCC model order
    Ls=ceil(Ns/12);
    for i=1:nfeat,
        func_str{i}{1}='fs=16000; type=0;';
        func_str{i}{2}=['Nc=' num2str(Ls(i)) ';'];
        func_str{i}{3}='[y, jout] = module_dftmsq(x, 0);';
        func_str{i}{4}='[w,jout] = module_mel_bank(y,jout,Nc,”spa”,type,fs);';
        func_str{i}{5}='[z,jout] = module_log(w, jout, [1:Nc]);';
        func_str{i}{6}='z=dct(z);';

        inv_str{i}{1}='fs=16000; type=0;';
        inv_str{i}{2}=['N=' num2str(Ns(i)) ';'];
        inv_str{i}{3}='z=idct(z);';
        inv_str{i}{4}='w=exp(z);';
        inv_str{i}{5}='y = module_mel_bank_synth(w,N,”maxent”,type,fs);';
        inv_str{i}{6}='x = module_dftmsq_synth(y, N);';
    end;
end;

Features are then computed using:
\begin{verbatim}
   % compute features
   [Z,J]=mrhmm_compute_features(X,func_str,Ns,K,shfts,max_segment_size);