changeset 119:c4d1208e5ea9 monophonicness

tidying up a bit
author Matthias Mauch <mail@matthiasmauch.net>
date Thu, 31 Mar 2011 14:59:11 +0100
parents 4663b1f184e8
children 7a8956e903e1
files NNLSChroma.cpp viterbi.cpp
diffstat 2 files changed, 7 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/NNLSChroma.cpp	Thu Mar 31 14:55:28 2011 +0100
+++ b/NNLSChroma.cpp	Thu Mar 31 14:59:11 2011 +0100
@@ -250,15 +250,14 @@
         consonancemean += consonancepattern[i]/nConsonance;
     }
     
-    // cerr << "consonancemean = " << consonancemean << endl;
-    
     for (int i = 0; i< nConsonance; ++i) {
         consonancepattern[i] -= consonancemean;
     }
-    if (debug_on) cerr << "--> getRemainingFeatures" << endl;
+    
+	if (debug_on) cerr << "--> getRemainingFeatures" << endl;
     FeatureSet fsOut;
     if (m_logSpectrum.size() == 0) return fsOut;
-    // 
+
     /**  Calculate Tuning
          calculate tuning from (using the angle of the complex number defined by the 
          cumulative mean real and imag values)
@@ -277,9 +276,7 @@
     char buffer0 [50];
 		
     sprintf(buffer0, "estimated tuning: %0.1f Hz", cumulativetuning);
-		    
-    // cerr << "normalisedtuning: " << normalisedtuning << '\n';
-		    
+		    		    
     /** Tune Log-Frequency Spectrogram
         calculate a tuned log-frequency spectrogram (f2): use the tuning estimated above (kinda f0) to 
         perform linear interpolation on the existing log-frequency spectrogram (kinda f1).
@@ -289,7 +286,6 @@
     float tempValue = 0;
     float dbThreshold = 0; // relative to the background spectrum
     float thresh = pow(10,dbThreshold/20);
-    // cerr << "tune local ? " << m_tuneLocal << endl;
     int count = 0;
 
 		
--- a/viterbi.cpp	Thu Mar 31 14:55:28 2011 +0100
+++ b/viterbi.cpp	Thu Mar 31 14:59:11 2011 +0100
@@ -6,22 +6,18 @@
     
     int nState = init.size();
     int nFrame = obs.size();
-    // cerr << nState << " " << nFrame << endl;
     
     // check for consistency
     if (trans[0].size() != nState || trans.size() != nState || obs[0].size() != nState) {
         cerr << "ERROR: matrix sizes inconsistent." << endl;
     }
-        
-    // vector<vector<double> > delta; // "matrix" of conditional probabilities    
+
     vector<vector<int> > psi; //  "matrix" of remembered indices of the best transitions
     vector<int> path = vector<int>(nFrame, nState-1); // the final output path (current assignment arbitrary, makes sense only for Chordino, where nChord-1 is the "no chord" label)
-    // vector<double> scale = vector<double>(nFrame, 0); // remembers by how much the vectors in delta are scaled.
     
     double deltasum = 0;
     
     /* initialise first frame */
-    // delta.push_back(init);    
     for (int iState = 0; iState < nState; ++iState) {
         delta[iState] = init[iState] * obs[0][iState];
         deltasum += delta[iState];
@@ -32,10 +28,9 @@
     
     /* rest of the forward step */
     for (int iFrame = 1; iFrame < nFrame; ++iFrame) {
-        // delta.push_back(vector<double>(nState,0));
         deltasum = 0;
         psi.push_back(vector<int>(nState,0));
-        /* every state wants to know which previous state suits him best */
+        /* every state wants to know which previous state suits it best */
         for (int jState = 0; jState < nState; ++jState) {            
             int bestState = nState - 1;
             double bestValue = 0;
@@ -48,7 +43,7 @@
                     }
                 }
             }
-            // cerr << bestState <<" ::: " << bestValue << endl ;
+
             delta[iFrame * nState + jState] = bestValue * obs[iFrame][jState];
             deltasum += delta[iFrame * nState + jState];
             psi[iFrame][jState] = bestState;
@@ -80,7 +75,6 @@
     /* rest of backward step */
     for (int iFrame = nFrame-2; iFrame > -1; --iFrame) {
         path[iFrame] = psi[iFrame+1][path[iFrame+1]];
-        // cerr << path[iFrame] << endl;
     }    
     
     return path;