changeset 59:b13d82111c8f tony

merge
author matthiasm
date Thu, 06 Mar 2014 16:48:27 +0000
parents b39d6745c596 (diff) 27682ab6070c (current diff)
children 60eb8771d340
files
diffstat 5 files changed, 19 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/MonoNoteParameters.cpp	Thu Mar 06 16:30:30 2014 +0000
+++ b/MonoNoteParameters.cpp	Thu Mar 06 16:48:27 2014 +0000
@@ -14,9 +14,9 @@
 #include "MonoNoteParameters.h"
 
 MonoNoteParameters::MonoNoteParameters() :
-    minPitch(36), 
+    minPitch(39), 
     nPPS(3), 
-    nS(43), 
+    nS(64), 
     nSPP(4), // states per pitch
     n(0),
     initPi(0), 
--- a/MonoPitchHMM.cpp	Thu Mar 06 16:30:30 2014 +0000
+++ b/MonoPitchHMM.cpp	Thu Mar 06 16:48:27 2014 +0000
@@ -22,7 +22,8 @@
 using std::pair;
 
 MonoPitchHMM::MonoPitchHMM() :
-m_minFreq(55),
+m_minFreq(77.782), // e flat 2
+// m_minFreq(110),
 m_nBPS(5),
 m_nPitch(0),
 m_transitionWidth(0),
@@ -31,7 +32,7 @@
 m_freqs(0)
 {
     m_transitionWidth = 9*(m_nBPS/2) + 1;
-    m_nPitch = 48 * m_nBPS;
+    m_nPitch = 64 * m_nBPS;
     m_freqs = vector<double>(2*m_nPitch);
     for (size_t iPitch = 0; iPitch < m_nPitch; ++iPitch)
     {
@@ -68,6 +69,8 @@
     }
     
     double probReallyPitched = m_yinTrust * probYinPitched;
+    // std::cerr << probReallyPitched << " " << probYinPitched << std::endl;
+    // damn, I forget what this is all about...
     for (size_t iPitch = 0; iPitch < m_nPitch; ++iPitch)
     {
         if (probYinPitched > 0) out[iPitch] *= (probReallyPitched/probYinPitched) ;
--- a/PYinVamp.cpp	Thu Mar 06 16:30:30 2014 +0000
+++ b/PYinVamp.cpp	Thu Mar 06 16:48:27 2014 +0000
@@ -35,7 +35,7 @@
     m_stepSize(256),
     m_blockSize(2048),
     m_fmin(40),
-    m_fmax(700),
+    m_fmax(1600),
     m_yin(2048, inputSampleRate, 0.0),
     m_oF0Candidates(0),
     m_oF0Probs(0),
@@ -366,7 +366,7 @@
     }
     rms /= m_blockSize;
     rms = sqrt(rms);
-    float lowAmp = 0.01;
+    float lowAmp = 0.05;
     bool isLowAmplitude = (rms < lowAmp);
     
     Yin::YinOutput yo = m_yin.processProbabilisticYin(dInputBuffers);
@@ -383,7 +383,7 @@
                 (tempPitch, yo.freqProb[iCandidate].second));
         else
             tempPitchProb.push_back(pair<double, double>
-                (tempPitch, yo.freqProb[iCandidate].second*((rms+lowAmp)/(2*lowAmp))));
+                (tempPitch, yo.freqProb[iCandidate].second*((rms+0.01*lowAmp)/(1.01*lowAmp))));
     }
     m_pitchProb.push_back(tempPitchProb);
     m_timestamp.push_back(timestamp);
@@ -455,6 +455,7 @@
     }
     
     // MONO-NOTE STUFF
+    std::cerr << "Mono Note Stuff" << std::endl;
     MonoNote mn;
     std::vector<std::vector<std::pair<double, double> > > smoothedPitch;
     for (size_t iFrame = 0; iFrame < mpOut.size(); ++iFrame) {
--- a/YinUtil.cpp	Thu Mar 06 16:30:30 2014 +0000
+++ b/YinUtil.cpp	Thu Mar 06 16:48:27 2014 +0000
@@ -31,11 +31,6 @@
     
     size_t frameSize = 2 * yinBufferSize;
     
-    for (size_t j = 0; j < yinBufferSize; ++j)
-    {
-        yinBuffer[j] = 0.;
-    }
-
     double *audioTransformedReal = new double[frameSize];
     double *audioTransformedImag = new double[frameSize];
     double *nullImag = new double[frameSize];
@@ -48,7 +43,8 @@
     
     for (size_t j = 0; j < yinBufferSize; ++j)
     {
-        powerTerms[j] = 0.;
+        yinBuffer[j] = 0.; // set to zero
+        powerTerms[j] = 0.; // set to zero
     }
     
     for (size_t j = 0; j < frameSize; ++j)
@@ -82,7 +78,6 @@
     // 2. half of the data, disguised as a convolution kernel
     for (size_t j = 0; j < yinBufferSize; ++j) {
         kernel[j] = in[yinBufferSize-1-j];
-        kernel[j+yinBufferSize] = 0;
     }
     Vamp::FFT::forward(frameSize, kernel, nullImag, kernelTransformedReal, kernelTransformedImag);
 
@@ -289,6 +284,11 @@
         }
     }
     
+    if (peakProb[minInd] > 1) {
+        std::cerr << "WARNING: yin has prob > 1 ??? I'm returning all zeros instead." << std::endl;
+        return(std::vector<double>(yinBufferSize));
+    }
+    
     double nonPeakProb = 1;
     if (sumProb > 0) {
         for (size_t i = minTau; i < maxTau; ++i)
@@ -297,7 +297,6 @@
             nonPeakProb -= peakProb[i];
         }
     }
-    // std::cerr << nonPeakProb << std::endl;
     if (minInd > 0)
     {
         // std::cerr << "min set " << minVal << " " << minInd << " " << nonPeakProb << std::endl; 
--- a/YinVamp.cpp	Thu Mar 06 16:30:30 2014 +0000
+++ b/YinVamp.cpp	Thu Mar 06 16:48:27 2014 +0000
@@ -34,7 +34,7 @@
     m_stepSize(256),
     m_blockSize(2048),
     m_fmin(40),
-    m_fmax(1000),
+    m_fmax(1600),
     m_yin(2048, inputSampleRate, 0.0),
     m_outNoF0(0),
     m_outNoPeriodicity(0),