changeset 90:b087967c4417

removed fourth "inter-note" state because it wasn't used anyway
author matthiasm
date Wed, 07 Jan 2015 15:22:03 +0000
parents 354c2c421661
children 854d9403c5be
files MonoNoteHMM.cpp MonoNoteParameters.cpp MonoPitchHMM.cpp PYIN.cpp
diffstat 4 files changed, 20 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/MonoNoteHMM.cpp	Wed Jan 07 14:36:30 2015 +0000
+++ b/MonoNoteHMM.cpp	Wed Jan 07 15:22:03 2015 +0000
@@ -165,15 +165,15 @@
         to.push_back(index+2);
         transProb.push_back(par.pSilentSelftrans);
         
-        // the "easy" inter state transition
-        from.push_back(index+3);
-        to.push_back(index+3);
-        transProb.push_back(par.pInterSelftrans);
+        // // the "easy" inter state transition
+        // from.push_back(index+3);
+        // to.push_back(index+3);
+        // transProb.push_back(par.pInterSelftrans);
         
         // the more complicated transitions from the silent and inter state
         double probSumSilent = 0;
-        double probSumInter = 0;
-        vector<double> tempTransProbInter;
+        // double probSumInter = 0;
+        // vector<double> tempTransProbInter;
         vector<double> tempTransProbSilent;
         for (size_t jPitch = 0; jPitch < (par.nS * par.nPPS); ++jPitch)
         {
@@ -191,24 +191,24 @@
 
                 double tempWeightSilent = boost::math::pdf(noteDistanceDistr, 
                                                            semitoneDistance);
-                double tempWeightInter = semitoneDistance == 0 ? 
-                                         0 : tempWeightSilent;
+                // double tempWeightInter = semitoneDistance == 0 ? 
+                //                          0 : tempWeightSilent;
                 probSumSilent += tempWeightSilent;
-                probSumInter += tempWeightInter;
+                // probSumInter += tempWeightInter;
 
                 tempTransProbSilent.push_back(tempWeightSilent);
-                tempTransProbInter.push_back(tempWeightInter);
+                // tempTransProbInter.push_back(tempWeightInter);
 
                 from.push_back(index+2);
                 to.push_back(toIndex);
-                from.push_back(index+3);
-                to.push_back(toIndex);                
+                // from.push_back(index+3);
+                // to.push_back(toIndex);                
             }
         }
         for (size_t i = 0; i < tempTransProbSilent.size(); ++i)
         {
             transProb.push_back((1-par.pSilentSelftrans) * tempTransProbSilent[i]/probSumSilent);
-            transProb.push_back((1-par.pInterSelftrans) * tempTransProbInter[i]/probSumInter);
+            // transProb.push_back((1-par.pInterSelftrans) * tempTransProbInter[i]/probSumInter);
         }
     }
 }
--- a/MonoNoteParameters.cpp	Wed Jan 07 14:36:30 2015 +0000
+++ b/MonoNoteParameters.cpp	Wed Jan 07 15:22:03 2015 +0000
@@ -16,17 +16,17 @@
 MonoNoteParameters::MonoNoteParameters() :
     minPitch(35), 
     nPPS(3), 
-    nS(50), 
-    nSPP(4), // states per pitch
+    nS(69), 
+    nSPP(3), // states per pitch
     n(0),
     initPi(0), 
     pAttackSelftrans(0.9),
     pStableSelftrans(0.99),
     pStable2Silent(0.01),
-    pSilentSelftrans(0.99999), 
+    pSilentSelftrans(0.9999), 
     sigma2Note(0.7),
     maxJump(13),
-    pInterSelftrans(0.9),
+    pInterSelftrans(0.0),
     priorPitchedProb(.7),
     priorWeight(0.5),
     minSemitoneDistance(.5),
--- a/MonoPitchHMM.cpp	Wed Jan 07 14:36:30 2015 +0000
+++ b/MonoPitchHMM.cpp	Wed Jan 07 15:22:03 2015 +0000
@@ -22,7 +22,7 @@
 using std::pair;
 
 MonoPitchHMM::MonoPitchHMM() :
-m_minFreq(27.5),
+m_minFreq(61.735),
 m_nBPS(5),
 m_nPitch(0),
 m_transitionWidth(0),
@@ -31,7 +31,7 @@
 m_freqs(0)
 {
     m_transitionWidth = 5*(m_nBPS/2) + 1;
-    m_nPitch = 72 * m_nBPS;
+    m_nPitch = 69 * m_nBPS;
     m_freqs = vector<double>(2*m_nPitch);
     for (size_t iPitch = 0; iPitch < m_nPitch; ++iPitch)
     {
--- a/PYIN.cpp	Wed Jan 07 14:36:30 2015 +0000
+++ b/PYIN.cpp	Wed Jan 07 15:22:03 2015 +0000
@@ -470,8 +470,6 @@
     std::vector<float> notePitchTrack; // collects pitches for one note at a time
     for (size_t iFrame = 0; iFrame < nFrame; ++iFrame)
     {
-        if (mnOut[iFrame].noteState>3)
-            std::cerr << mnOut[iFrame].noteState << std::endl;
         isVoiced = mnOut[iFrame].noteState < 3 && smoothedPitch[iFrame].size() > 0;
         if (isVoiced && iFrame != nFrame-1)
         {
@@ -483,7 +481,7 @@
             float pitch = smoothedPitch[iFrame][0].first;
             notePitchTrack.push_back(pitch); // add to the note's pitch track
         } else { // not currently voiced
-            if (oldIsVoiced == 1 && notePitchTrack.size() > 17) // end of the note
+            if (oldIsVoiced == 1 && notePitchTrack.size() > 17) // end of note
             {
                 std::sort(notePitchTrack.begin(), notePitchTrack.end());
                 float medianPitch = notePitchTrack[notePitchTrack.size()/2];