add windowing, correct phase interpolation
authorPaul Brossier <piem@altern.org>
Tue, 21 Mar 2006 18:03:37 +0000 (18:03 +0000)
committerPaul Brossier <piem@altern.org>
Tue, 21 Mar 2006 18:03:37 +0000 (18:03 +0000)
add windowing, correct phase interpolation

src/pitchfcomb.c

index 6173bea075f9b48d998cd366a8e8116ff78bcdcf..f9e37ee7fa94d3a9cd992875b479d03a11809626 100644 (file)
@@ -83,7 +83,7 @@ smpl_t aubio_pitchfcomb_detect (aubio_pitchfcomb_t * p, fvec_t * input)
   for (k=0; k < input->length; k++){
          p->winput->data[0][k] = p->win->data[0][k] * input->data[0][k];
   }
-  aubio_mfft_do(p->fft,input,p->fftOut);
+  aubio_mfft_do(p->fft,p->winput,p->fftOut);
 
   for (k=0; k<=p->fftSize/2; k++) {
     smpl_t
@@ -99,10 +99,10 @@ smpl_t aubio_pitchfcomb_detect (aubio_pitchfcomb_t * p, fvec_t * input)
     tmp -= (smpl_t)k*phaseDifference;
 
     /* map delta phase into +/- Pi interval */
-    tmp = aubio_unwrap2pi(tmp) + PI;
+    tmp = aubio_unwrap2pi(tmp);
 
     /* get deviation from bin frequency from the +/- Pi interval */
-    tmp = p->stepSize/(smpl_t)p->fftSize*tmp/(TWO_PI);
+    tmp = p->fftSize/(smpl_t)p->stepSize*tmp/(TWO_PI);
 
     /* compute the k-th partials' true frequency */
     freq = (smpl_t)k*freqPerBin + tmp*freqPerBin;