changeset 89:354c2c421661

some parameter changes for note and also pitch track (this may not be wise, since I made some different changes for the tony branch.. will have to merge at some point)
author matthiasm
date Wed, 07 Jan 2015 14:36:30 +0000
parents 585fdda4d7f9
children b087967c4417
files MonoNoteHMM.cpp MonoNoteParameters.cpp MonoPitchHMM.cpp PYIN.cpp
diffstat 4 files changed, 24 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/MonoNoteHMM.cpp	Thu Dec 04 18:27:00 2014 +0000
+++ b/MonoNoteHMM.cpp	Wed Jan 07 14:36:30 2015 +0000
@@ -68,7 +68,9 @@
                         minDistCandidate = iCandidate;
                     }
                 }
-                tempProb = std::pow(minDistProb, par.yinTrust) * boost::math::pdf(pitchDistr[i], pitchProb[minDistCandidate].first);
+                tempProb = std::pow(minDistProb, par.yinTrust) * 
+                           boost::math::pdf(pitchDistr[i], 
+                                            pitchProb[minDistCandidate].first);
             } else {
                 tempProb = 1;
             }
@@ -177,15 +179,20 @@
         {
             int fromPitch = iPitch;
             int toPitch = jPitch;
-            double semitoneDistance = std::abs(fromPitch - toPitch) * 1.0 / par.nPPS;
+            double semitoneDistance = 
+                std::abs(fromPitch - toPitch) * 1.0 / par.nPPS;
             
             // if (std::fmod(semitoneDistance, 1) == 0 && semitoneDistance > par.minSemitoneDistance)
-            if (semitoneDistance == 0 || (semitoneDistance > par.minSemitoneDistance && semitoneDistance < par.maxJump))
+            if (semitoneDistance == 0 || 
+                (semitoneDistance > par.minSemitoneDistance 
+                 && semitoneDistance < par.maxJump))
             {
                 size_t toIndex = jPitch * par.nSPP; // note attack index
 
-                double tempWeightSilent = boost::math::pdf(noteDistanceDistr, semitoneDistance);
-                double tempWeightInter = semitoneDistance == 0 ? 0 : tempWeightSilent;
+                double tempWeightSilent = boost::math::pdf(noteDistanceDistr, 
+                                                           semitoneDistance);
+                double tempWeightInter = semitoneDistance == 0 ? 
+                                         0 : tempWeightSilent;
                 probSumSilent += tempWeightSilent;
                 probSumInter += tempWeightInter;
 
--- a/MonoNoteParameters.cpp	Thu Dec 04 18:27:00 2014 +0000
+++ b/MonoNoteParameters.cpp	Wed Jan 07 14:36:30 2015 +0000
@@ -14,19 +14,19 @@
 #include "MonoNoteParameters.h"
 
 MonoNoteParameters::MonoNoteParameters() :
-    minPitch(36), 
+    minPitch(35), 
     nPPS(3), 
-    nS(43), 
+    nS(50), 
     nSPP(4), // states per pitch
     n(0),
     initPi(0), 
-    pAttackSelftrans(0.5),
-    pStableSelftrans(0.999),
-    pStable2Silent(0.005),
-    pSilentSelftrans(0.5), 
+    pAttackSelftrans(0.9),
+    pStableSelftrans(0.99),
+    pStable2Silent(0.01),
+    pSilentSelftrans(0.99999), 
     sigma2Note(0.7),
     maxJump(13),
-    pInterSelftrans(0.99),
+    pInterSelftrans(0.9),
     priorPitchedProb(.7),
     priorWeight(0.5),
     minSemitoneDistance(.5),
--- a/MonoPitchHMM.cpp	Thu Dec 04 18:27:00 2014 +0000
+++ b/MonoPitchHMM.cpp	Wed Jan 07 14:36:30 2015 +0000
@@ -22,7 +22,7 @@
 using std::pair;
 
 MonoPitchHMM::MonoPitchHMM() :
-m_minFreq(55),
+m_minFreq(27.5),
 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 = 48 * m_nBPS;
+    m_nPitch = 72 * m_nBPS;
     m_freqs = vector<double>(2*m_nPitch);
     for (size_t iPitch = 0; iPitch < m_nPitch; ++iPitch)
     {
--- a/PYIN.cpp	Thu Dec 04 18:27:00 2014 +0000
+++ b/PYIN.cpp	Wed Jan 07 14:36:30 2015 +0000
@@ -470,6 +470,8 @@
     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)
         {
@@ -481,7 +483,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() > 4) // end of the note
+            if (oldIsVoiced == 1 && notePitchTrack.size() > 17) // end of the note
             {
                 std::sort(notePitchTrack.begin(), notePitchTrack.end());
                 float medianPitch = notePitchTrack[notePitchTrack.size()/2];