shithub: aubio

Download patch

ref: 1942323f14ca44b9e478ff95cae037fde148ff72
parent: bc4e1758ccf961afbaae7c9664a222958c8ff3d7
author: Paul Brossier <piem@piem.org>
date: Thu Oct 1 05:04:35 EDT 2009

src/onset/onsetdetection.c: fix off by one error in complexdomain without complex.h

--- a/src/onset/onsetdetection.c
+++ b/src/onset/onsetdetection.c
@@ -87,11 +87,11 @@
             );
 #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)*/