www.pudn.com > CELP.ZIP > decoder.m


function [spch_syn]=decoder(frm_num) 
 
global frames szsubf sub_cnt nsubf cindex cgain pcode pgain descalor pbuf lbuf lpcMat %codebook_lpc lpcword  
global b_hpf a_hpf d_hpf1 b_lpf a_lpf d_lpf1 olpc ALPHA BETA ip op TRUE FALSE 
 
dp1=zeros(1,olpc+1); 
dp2=zeros(1,olpc+1); 
dp3=zeros(1,2); 
 
 
for frm_count=1:frm_num 
    offset=(frm_count-1)*frames; 
    for isub=1:nsubf 
        sub_cnt=sub_cnt+1; 
         
        lpt=(isub-1)*szsubf+1; hpt=lpt+szsubf-1;            % Set segment range for decoding in each frame 
         
        % Re-synthesize stochastic excitation components 
        syn_e0(lpt:hpt)=exc_syn(cindex(sub_cnt),cgain(sub_cnt));         
         
        % Re-synthesize pitch components, given stochastic excitation 
        [syn_e1(lpt:hpt),pbuf]=pitch_syn(syn_e0(lpt:hpt),pbuf,pcode(sub_cnt),pgain(sub_cnt)); 
         
        % Re-synthesize speech on sub-frame level, given synthesized pitch 
        [voc(lpt:hpt),lbuf]=lpcr(lpcMat(frm_count,:),lbuf,syn_e1(lpt:hpt)); 
         
        % Scale down synthesized speech  
        voc(lpt:hpt)=voc(lpt:hpt)*descalor; 
        % Postfilter the syn speech 
        [ voc(lpt:hpt), ip, op, dp1, dp2, dp3 ] = ... 
        postfilt( voc(lpt:hpt), szsubf, ALPHA, BETA, ip, op, dp1, dp2, dp3, lpcMat(frm_count,:), olpc ); 
         
    end 
     
    [voc,d_hpf1]=filter(b_hpf,a_hpf,voc,d_hpf1);                 % Highpass filter output speech at 100 HZ 
        
    spch_syn(offset+1:offset+frames)=voc; 
end