shithub: aubio

Download patch

ref: dea34a1fa660219ac8f27471ec65da0bb16c8b72
parent: 0c83de6589bf89e89e636878510449730e649f70
author: Paul Brossier <piem@piem.org>
date: Fri Jul 27 06:37:38 EDT 2012

src/spectral/tss.c: clarify

--- a/src/spectral/tss.c
+++ b/src/spectral/tss.c
@@ -60,32 +60,30 @@
         -2.0*theta1[j]+theta2[j]);
     theta2[j] = theta1[j];
     theta1[j] = input->phas[j];
-  }
 
-  for (j=0;j<nbins; j++){
     /* transient analysis */
     test = (ABS(dev[j]) > parm*oft1[j]);
     trans->norm[j] = input->norm[j] * test;
     trans->phas[j] = input->phas[j] * test;
-  }
 
-  for (j=0;j<nbins; j++){
     /* steady state analysis */
     test = (ABS(dev[j]) < parm*oft2[j]);
     stead->norm[j] = input->norm[j] * test;
     stead->phas[j] = input->phas[j] * test;
 
-    /*increase sstate probability for sines */
+    /*increase probability for transient */
     test = (trans->norm[j]==0.);
     oft1[j]  = test;
-    test = (stead->norm[j]==0.);
-    oft2[j]  = test;
     test = (trans->norm[j]>0.);
     oft1[j] += alpha*test;
-    test = (stead->norm[j]>0.);
-    oft2[j] += alpha*test;
     test = (oft1[j]>1. && trans->norm[j]>0.);
     oft1[j] += beta*test;
+
+    /*increase probability for steady states */
+    test = (stead->norm[j]==0.);
+    oft2[j]  = test;
+    test = (stead->norm[j]>0.);
+    oft2[j] += alpha*test;
     test = (oft2[j]>1. && stead->norm[j]>0.);
     oft2[j] += beta*test;
   }