fixed occasional case of writing to DFT past nyquist point, dur to quantisation or...
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Wed, 1 Dec 2010 01:43:59 +0000 (01:43 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Wed, 1 Dec 2010 01:43:59 +0000 (01:43 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@255 01035d8c-6547-0410-b346-abe4f91aad63

codec2/src/phase.c
codec2/src/sine.c

index 80dfaa25e2638d47bb0c7de285bd55208f714875..1964a43bac75c159009d462454bc3cc0136dd125 100644 (file)
@@ -231,6 +231,9 @@ void phase_synth_zero_order(
        */
         jitter = 0.25*(1.0 - 2.0*rand()/RAND_MAX);
         b = floor(m*model->Wo/r + 0.5);
+       if (b > ((GLOTTAL_FFT_SIZE/2)-1)) {
+               b = (GLOTTAL_FFT_SIZE/2)-1;
+       }
        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]);
     }
index 974f315ebb0b398fa5d430d705faa71dff6a5f0d..f009636641c42b462fd8e2bbfcbb553299230c00 100644 (file)
@@ -593,6 +593,9 @@ void synthesise(
     /* Now set up frequency domain synthesised speech */
     for(l=1; l<=model->L; l++) {
        b = floor(l*model->Wo*FFT_DEC/TWO_PI + 0.5);
+       if (b > ((FFT_DEC/2)-1)) {
+               b = (FFT_DEC/2)-1;
+       }
        Sw_[b].real = model->A[l]*cos(model->phi[l]);
        Sw_[b].imag = model->A[l]*sin(model->phi[l]);
        Sw_[FFT_DEC-b].real = Sw_[b].real;