src/onset/onsetdetection.c: fix off by one error in complexdomain without complex.h
authorPaul Brossier <piem@piem.org>
Thu, 1 Oct 2009 07:04:35 +0000 (09:04 +0200)
committerPaul Brossier <piem@piem.org>
Thu, 1 Oct 2009 07:04:35 +0000 (09:04 +0200)
src/onset/onsetdetection.c

index dc8f6fa472d6a53c4235a21f78ce25fe73276ea1..86312e443f94babc4251f98a86b10b03cec62bde 100644 (file)
@@ -87,11 +87,11 @@ void aubio_onsetdetection_complex (aubio_onsetdetection_t *o, cvec_t * fftgrain,
             );
 #else
       o->meas[j]             = (fftgrain->norm[i][j])*COS(o->dev1->data[i][j]);
-      o->meas[(nbins-1)*2-j] = (fftgrain->norm[i][j])*SIN(o->dev1->data[i][j]);
+      o->meas[(nbins-1)*2-1-j] = (fftgrain->norm[i][j])*SIN(o->dev1->data[i][j]);
       /* sum on all bins */
       onset->data[i][0]     += //(fftgrain->norm[i][j]);
           SQRT(SQR( (o->oldmag->data[i][j]-o->meas[j]) )
-            +  SQR( (-o->meas[(nbins-1)*2-j]) )
+            +  SQR( (-o->meas[(nbins-1)*2-1-j]) )
             );
 #endif
       /* swap old phase data (need to remember 2 frames behind)*/