yet another subtle bug in combining phase 0 and lpc 10 models, sounds better now
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Sat, 26 Sep 2009 00:18:14 +0000 (00:18 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Sat, 26 Sep 2009 00:18:14 +0000 (00:18 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@65 01035d8c-6547-0410-b346-abe4f91aad63

codec2/src/codeall.sh [new file with mode: 0755]
codec2/src/sinedec.c

diff --git a/codec2/src/codeall.sh b/codec2/src/codeall.sh
new file mode 100755 (executable)
index 0000000..6bdf825
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+# codeall.sh
+# David Rowe 24 sep 2009
+# Code all samples using various processing steps
+./code.sh hts1a
+./code.sh hts2a
+./code.sh mmt1
+./code.sh morig
+./code.sh forig
index bf840f21634ca459e78c0efcb94dc06b69024d53..b63547e5294f1972315fa1a0834b5c7b1e2e44d4 100644 (file)
@@ -197,32 +197,38 @@ int main(int argc, char *argv[])
 
     dump_model(&model);
 
-    /* optional phase modelling - make sure this happens before LPC modelling
-       as first order model fit doesn't work well with LPC Modelled {Am} */
+    /* optional phase modelling - make sure this happens before LPC
+       modelling of {Am} as first order model fit doesn't work well
+       with LPC Modelled {Am} (not sure why - investigate later) */
 
     if (phase) {
        float Wn[M];                    /* windowed speech samples */
        float Rk[PHASE_LPC_ORD+1];      /* autocorrelation coeffs  */
+       float ak_phase[PHASE_LPC_ORD+1];/* LPCs                    */
         COMP  H[MAX_AMP];               /* LPC freq domain samples */
        float n_min;
        COMP  min_Am;
        
        dump_phase(&model.phi[0]);
 
-       if (!lpc_model) {
-           /* Determine LPC model using time domain LPC if we don't have
-              any LPCs yet */
+       /* Determine LPCs for phase modelling.  Note that we may also
+          find the LPCs as part of the {Am} modelling, this can
+          probably be combined in the final codec.  However during
+          development some subtle bugs were found when combining LPC
+          and phase models so for the purpose of development it's
+          easier to find LPCs indepenently for phase modelling
+          here. */
 
-           for(i=0; i<M; i++)
-               Wn[i] = Sn[i]*w[i];
-           autocorrelate(Wn,Rk,M,PHASE_LPC_ORD);
-           levinson_durbin(Rk,ak,PHASE_LPC_ORD);
-       }
-       else
-         assert(order == PHASE_LPC_ORD);
+       for(i=0; i<M; i++)
+           Wn[i] = Sn[i]*w[i];
+       autocorrelate(Wn,Rk,M,PHASE_LPC_ORD);
+       levinson_durbin(Rk,ak_phase,PHASE_LPC_ORD);
+
+       if (lpc_model)
+           assert(order == PHASE_LPC_ORD);
 
-       dump_ak(ak, PHASE_LPC_ORD);
-       snr = phase_model_first_order(ak, H, &n_min, &min_Am);
+       dump_ak(ak_phase, PHASE_LPC_ORD);
+       snr = phase_model_first_order(ak_phase, H, &n_min, &min_Am);
 
        dump_snr(snr);
        if (phase_model == 0) {
@@ -234,12 +240,12 @@ int main(int argc, char *argv[])
 
        if (phase_model == 1) {
            phase_synth_first_order(snr, H, n_min, min_Am);
-            dump_phase_(&model.phi[0]);
         }
 
         if (postfilt)
            postfilter(&model, snr>2.0, &bg_est);
 
+        dump_phase_(&model.phi[0]);
     }
 
     /* optional LPC model amplitudes */