added phase from LPC-10 glottal pulse, see octave/glottal.m, adds a little more dispe...
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Tue, 16 Nov 2010 09:34:34 +0000 (09:34 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Tue, 16 Nov 2010 09:34:34 +0000 (09:34 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@235 01035d8c-6547-0410-b346-abe4f91aad63

codec2/src/glottal.c [new file with mode: 0644]
codec2/src/phase.c

diff --git a/codec2/src/glottal.c b/codec2/src/glottal.c
new file mode 100644 (file)
index 0000000..d4117b9
--- /dev/null
@@ -0,0 +1,257 @@
+float glottal[]={
+  0.000000,
+  -0.057687,
+  -0.115338,
+  -0.172917,
+  -0.230385,
+  -0.287707,
+  -0.344845,
+  -0.401762,
+  -0.458419,
+  -0.514781,
+  -0.570809,
+  -0.626467,
+  -0.681721,
+  -0.736537,
+  -0.790884,
+  -0.844733,
+  -0.898057,
+  -0.950834,
+  -1.003044,
+  -1.054670,
+  -1.105700,
+  -1.156124,
+  -1.205936,
+  -1.255132,
+  -1.303711,
+  -1.351675,
+  -1.399026,
+  -1.445769,
+  -1.491908,
+  -1.537448,
+  -1.582393,
+  -1.626747,
+  -1.670514,
+  -1.713693,
+  -1.756285,
+  -1.798288,
+  -1.839697,
+  -1.880507,
+  -1.920712,
+  -1.960302,
+  -1.999269,
+  -2.037603,
+  -2.075295,
+  -2.112335,
+  -2.148716,
+  -2.184430,
+  -2.219472,
+  -2.253839,
+  -2.287531,
+  -2.320550,
+  -2.352900,
+  -2.384588,
+  -2.415623,
+  -2.446019,
+  -2.475788,
+  -2.504946,
+  -2.533512,
+  -2.561501,
+  -2.588934,
+  -2.615827,
+  -2.642198,
+  -2.668064,
+  -2.693439,
+  -2.718337,
+  -2.742767,
+  -2.766738,
+  -2.790256,
+  -2.813322,
+  -2.835936,
+  -2.858094,
+  -2.879790,
+  -2.901016,
+  -2.921759,
+  -2.942008,
+  -2.961747,
+  -2.980961,
+  -2.999632,
+  -3.017745,
+  -3.035282,
+  -3.052228,
+  -3.068567,
+  -3.084285,
+  -3.099371,
+  -3.113813,
+  -3.127605,
+  -3.140738,
+  3.129975,
+  3.118167,
+  3.107022,
+  3.096537,
+  3.086709,
+  3.077531,
+  3.068996,
+  3.061096,
+  3.053821,
+  3.047159,
+  3.041102,
+  3.035636,
+  3.030753,
+  3.026441,
+  3.022690,
+  3.019491,
+  3.016836,
+  3.014718,
+  3.013132,
+  3.012072,
+  3.011535,
+  3.011521,
+  3.012028,
+  3.013057,
+  3.014612,
+  3.016695,
+  3.019310,
+  3.022463,
+  3.026160,
+  3.030407,
+  3.035212,
+  3.040580,
+  3.046520,
+  3.053038,
+  3.060141,
+  3.067836,
+  3.076128,
+  3.085023,
+  3.094525,
+  3.104639,
+  3.115367,
+  3.126712,
+  3.138674,
+  -3.131930,
+  -3.118731,
+  -3.104915,
+  -3.090485,
+  -3.075444,
+  -3.059795,
+  -3.043543,
+  -3.026695,
+  -3.009254,
+  -2.991229,
+  -2.972625,
+  -2.953449,
+  -2.933710,
+  -2.913414,
+  -2.892567,
+  -2.871176,
+  -2.849248,
+  -2.826787,
+  -2.803798,
+  -2.780284,
+  -2.756247,
+  -2.731689,
+  -2.706609,
+  -2.681005,
+  -2.654875,
+  -2.628213,
+  -2.601015,
+  -2.573272,
+  -2.544977,
+  -2.516121,
+  -2.486694,
+  -2.456686,
+  -2.426084,
+  -2.394879,
+  -2.363060,
+  -2.330616,
+  -2.297538,
+  -2.263816,
+  -2.229444,
+  -2.194416,
+  -2.158727,
+  -2.122375,
+  -2.085359,
+  -2.047682,
+  -2.009347,
+  -1.970361,
+  -1.930732,
+  -1.890470,
+  -1.849587,
+  -1.808098,
+  -1.766017,
+  -1.723360,
+  -1.680145,
+  -1.636388,
+  -1.592105,
+  -1.547313,
+  -1.502025,
+  -1.456256,
+  -1.410016,
+  -1.363314,
+  -1.316157,
+  -1.268547,
+  -1.220486,
+  -1.171971,
+  -1.122997,
+  -1.073555,
+  -1.023636,
+  -0.973227,
+  -0.922312,
+  -0.870875,
+  -0.818899,
+  -0.766366,
+  -0.713257,
+  -0.659554,
+  -0.605242,
+  -0.550303,
+  -0.494723,
+  -0.438492,
+  -0.381598,
+  -0.324036,
+  -0.265800,
+  -0.206889,
+  -0.147303,
+  -0.087046,
+  -0.026121,
+  0.035463,
+  0.097698,
+  0.160576,
+  0.224087,
+  0.288221,
+  0.352969,
+  0.418323,
+  0.484276,
+  0.550822,
+  0.617958,
+  0.685681,
+  0.753991,
+  0.822889,
+  0.892378,
+  0.962462,
+  1.033144,
+  1.104430,
+  1.176325,
+  1.248833,
+  1.321956,
+  1.395696,
+  1.470051,
+  1.545019,
+  1.620593,
+  1.696763,
+  1.773516,
+  1.850837,
+  1.928705,
+  2.007097,
+  2.085987,
+  2.165347,
+  2.245145,
+  2.325347,
+  2.405919,
+  2.486824,
+  2.568025,
+  2.649485,
+  2.731167,
+  2.813033,
+  2.895045,
+  2.977167,
+  3.059362};
index 5210f64b228bbc0de73a71f13aeef277c62b5220..2349c3f56d701c64f71680d86a85d0384bbe503a 100644 (file)
 #include "phase.h"
 #include "four1.h"
 #include "comp.h"
+#include "glottal.c"
 
 #include <assert.h>
 #include <math.h>
 #include <string.h>
 #include <stdlib.h>
 
-#define VTHRESH 4.0
+#define GLOTTAL_FFT_SIZE 512
 
 /*---------------------------------------------------------------------------*\
 
@@ -199,6 +200,8 @@ void phase_synth_zero_order(
   COMP  H[MAX_AMP];             /* LPC freq domain samples */
   float G;
   float jitter;
+  float r;
+  int   b;
 
   G = 1.0;
   aks_to_H(model,aks,G,H,LPC_ORD);
@@ -214,6 +217,7 @@ void phase_synth_zero_order(
   
   ex_phase[0] += (model->Wo)*N;
   ex_phase[0] -= TWO_PI*floor(ex_phase[0]/TWO_PI + 0.5);
+  r = TWO_PI/GLOTTAL_FFT_SIZE;
 
   for(m=1; m<=model->L; m++) {
 
@@ -225,8 +229,9 @@ void phase_synth_zero_order(
           over at +/- 0.25 of a sample.
        */
         jitter = 0.25*(1.0 - 2.0*rand()/RAND_MAX);
-       Ex[m].real = cos(ex_phase[0]*m - jitter*model->Wo*m);
-       Ex[m].imag = sin(ex_phase[0]*m - jitter*model->Wo*m);
+        b = floor(m*model->Wo/r + 0.5);
+       Ex[m].real = cos(ex_phase[0]*m - jitter*model->Wo*m + glottal[b]);
+       Ex[m].imag = sin(ex_phase[0]*m - jitter*model->Wo*m + glottal[b]);
     }
     else {