notes:

1. check  base_angle =  M_PI / (double)(K-1) vs K=fftlength.

PP:

p->rate=sample_rate  [8000]
p->windowsz_ms  [10]
p->framesz_ms   [10]
p->windowsz=floor(windowsz_ms * sample_rate * 1e-3 + 0.5)  [80]
p->framesz =floor(framesz_ms * sample_rate * 1e-3 + 0.5)   [80]
   nyq_bar = 6.0*log(p->rate/1200+sqrt(p->rate/1200*p->rate/1200+1.0))[15.5751]
   log2length=ceil(pow2(p->windowsz)) [7]
p->npoints = (int)pow(2.0,log2length)  [128]
   hz_in_samp = p->npoints/sample_rate   [0.016]    (samples/Hz)

p->pp_order      [7]  AR
p->pp_outputs    [8]  AR

p->nfilts        [17]
p->first_good    [1]
p->last_filt = nfilts-1  [16]
p->exponent     [0.6]
p->rasta        [0]

p->in(p->windowsz)  [80]
p->out(p->npoints)  [128]
p->hammingwindow(p->windowsz) [80]

BARK: ---------------------------------
p->frangesz = nfilts      [17]
p->frange(p->frangesz)    [17,int]
p->cbrangesz = 2 * nfilts    [34]
p->cbrange(p->cbrangesz )    [34,int]
   get_ranges(p->frange,p->cbrange,nyq_bar,hz_in_samp,nfilts,first_good,p->last_filt,p->npoints/2)

      frange ....[..,n0_bi,..],  i=[first_good,last_filt) = [1,last_filt)
                 sample in fft of left of band
                 valid..... [first_good,last_filt)

      cbrange ...[..,n0_bi,n1_bi,..],   i=[first_good,last_filt) = [1,last_filt)
                 left-right index pairs into
                 vector of band weightings n0_bi = n1_b(i-1)+1
                 valid..... [0,2*(last_filt-first_good)-1]

p->cbweightssz = (p->cbrange[(2*(p->last_filt-first_good))-1] + 1)
p->cbweights(p->cbweightssz)     [float]
   get_cbweights(p->frange,p->cbrange,p->cbweights,nyq_bar,hz_in_samp,nfilts,first_good,p->last_filt)
            vector of band weightings for bands i=[first_good,last_filt)
            valid..... [0,p->cbrange[2*(last_filt-first_good)-1]]
------------------------------------------------------------------
MEL AND LIN
p->frangesz = nfilts+1      [18]
p->frange(p->frangesz)      (int)
p->cbrangesz = 2 * nfilts    [34]
p->cbrange(p->cbrangesz )    (int)
   get_mel_ranges(p->frange,p->cbrange, sample_rate, hz_in_samp, nfilts,
		     p->first_good,p->last_filt);
   get_lin_ranges(p->frange,p->cbrange, sample_rate, hz_in_samp, nfilts,
		     p->first_good,p->last_filt);

      frange ....[..,n0_bi,..],  i=[first_good,last_filt) = [1,last_filt)
                 sample in fft of left of band
                 valid..... [first_good-1,last_filt+1)  (+-1 is for left and right edges)

      cbrange ...[..,n0_bi,n1_bi,..],   i=[first_good,last_filt) = [1,last_filt)
                 left-right index pairs into
                 vector of band weightings n0_bi = n1_b(i-1)+1
                 valid..... [0,2*(last_filt-first_good)-1]

p->cbweightssz = (p->cbrange[(2*(p->last_filt-first_good))-1] + 1)
p->cbweights(p->cbweightssz)     (float)
   get_triag_cbweights(p->frange,p->cbrange,p->cbweights,nfilts,
                       p->first_good,p->last_filt)
            vector of band weightings for bands i=[first_good,last_filt)
            valid..... [0,p->cbrange[2*(last_filt-first_good)-1]]

-------------------------------------------------------

p->eqlsz = nfilts
p->eql=(p->eqlsz)  (float)
   get_eqlcurve(p->eql,nyq_bar,nfilts,p->first_good,p->last_filt)
            vector of equal loudness curve weights
            valid..... [first_good,last_filt)

==========================================================================================
AR MODEL

   fftlength=ceil(pow2(nfilts))
p->costablesz = nfilts*(pp_order+1)
p->costable(p->costablesz)   (float)
   get_dfttable(p->costable, nfilts, pp_order+1)
        gives vector table (k is the fastest index) for IDFT transform:
        x(n) = 1/N*[1*x(0) + 2*sum_{k=1}^{N-1} x(k)*cos(2*pi/N*n*k)], n=0:pp_order
        where N == fftlength

    GENERAL  ----------------------------------

    in=hammingwindow(in,p->windowsz)                [0,p->windowsz) -> [0,p->windowsz)
 
    out=powerspectrum(in,p->windowsz,p->npoints)    [0,p->windowsz) -> [0,p->npoints/2)

    in=audsp(out,first_good,last_filt)              [0,p->npoints/2) -> [first_good,last_filt)
    
    ------------------------------------------ 

    in=equalloudness(in,nfilts,first_good,last_filt)     [first_good,last_filt) -> 
                                                     copy[0,first_good)
                                                         [first_good,last_filt)
                                                     copy[last_filt,nfilts)

    out=invdft(in,pp_order,p->nfilts)               [0,nfilts) -> [0,pp_order]

    in=durbin(out,pp_order)                         [0,pp_order] ->  [0,pp_order]

    out=lpccep(in,pp_order,pp_output)               [0,pp_order] -> [0,pp_output)

    out=gexp(out,pp_output)                         [0,pp_output)
    
    pp=memcpy(out,pp_output)                        [0,pp_output)


==============================================================================
DCT MODEL

p->nfilts=(p->nfilts<p->pp_order+4)?p->pp_order+4:p->nfilts
p->pp_output=p->last_filt - p->first_good
p->pp_output=(p->pp_output < p->pp_order)?p->pp_output+1:p->pp_order+1
p->costablesz=(p->pp_output * (p->last_filt-p->first_good))
p->costable(p->costablesz)  (float)
    get_dcttable(p->costable, p->pp_output, p->last_filt-p->first_good)
    N=p->pp_output-1
    K=p->last_filt - p->first_good
    gives (1+N) x K DCT table

    GENERAL  ----------------------------------

    in=preemphasis(in,preemp);                      [0,p->windowsz) -> [0,p->windowsz)

    in=hammingwindow(in,p->windowsz)                [0,p->windowsz) -> [0,p->windowsz)
 
    out=powerspectrum(in,p->windowsz,p->npoints)    [0,p->windowsz) -> [0,p->npoints/2)

    in=audsp(out,first_good,last_filt)              [0,p->npoints/2) -> [first_good,last_filt)
    
    ------------------------------------------ 

    in=nl_ppspec(in,first_good,last_filt);        [first_good,last_filt) -> [first_good,last_filt)

    out=invdct(in,pp_output,nfilts)               [first_good,last_filt) -> [0,pp_output)

    out=gexp(out,pp_output)                       [0,pp_output) -> [0,pp_output)
    
    pp=memcpy(out,pp_output)                      [0,pp_output) -> [0,pp_output)



	


