changeset 72:fa3a2dbd09a3 tony

made the low amplitude suppression a parameter
author matthiasm
date Fri, 13 Jun 2014 19:37:39 +0100
parents 27eee0f7a4f6
children 062f0e491877
files PYinVamp.cpp PYinVamp.h
diffstat 2 files changed, 22 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/PYinVamp.cpp	Fri Jun 13 11:54:22 2014 +0100
+++ b/PYinVamp.cpp	Fri Jun 13 19:37:39 2014 +0100
@@ -46,6 +46,7 @@
     m_threshDistr(2.0f),
     m_outputUnvoiced(0.0f),
     m_preciseTime(0.0f),
+    m_lowAmp(0.2),
     m_pitchProb(0),
     m_timestamp(0)
 {
@@ -176,6 +177,16 @@
     d.quantizeStep = 1.0f;
     list.push_back(d);
 
+    d.identifier = "lowampsuppression";
+    d.valueNames.clear();
+    d.name = "Suppress low amplitude pitch estimates.";
+    d.description = ".";
+    d.unit = "";
+    d.minValue = 0.0f;
+    d.maxValue = 1.0f;
+    d.defaultValue = 0.2f;
+    d.isQuantized = false;
+    list.push_back(d);
 
     return list;
 }
@@ -192,6 +203,9 @@
     if (identifier == "precisetime") {
             return m_preciseTime;
     }
+    if (identifier == "lowampsuppression") {
+            return m_lowAmp;
+    }
     return 0.f;
 }
 
@@ -210,6 +224,10 @@
     {
         m_preciseTime = value;
     }
+    if (identifier == "lowampsuppression")
+    {
+        m_lowAmp = value;
+    }
 }
 
 PYinVamp::ProgramList
@@ -387,9 +405,9 @@
     }
     rms /= m_blockSize;
     rms = sqrt(rms);
-    float lowAmp = 0.1;
-    bool isLowAmplitude = (rms < lowAmp);
-    float factor = ((rms+0.01*lowAmp)/(1.01*lowAmp));
+    // float m_lowAmp = 0.5;
+    bool isLowAmplitude = (rms < m_lowAmp);
+    float factor = ((rms+0.01*m_lowAmp)/(1.01*m_lowAmp));
     // std::cerr << rms << " " << factor << std::endl;
     
     Yin::YinOutput yo = m_yin.processProbabilisticYin(dInputBuffers);
--- a/PYinVamp.h	Fri Jun 13 11:54:22 2014 +0100
+++ b/PYinVamp.h	Fri Jun 13 19:37:39 2014 +0100
@@ -73,6 +73,7 @@
     float m_threshDistr;
     float m_outputUnvoiced;
     float m_preciseTime;
+    float m_lowAmp;
     vector<vector<pair<double, double> > > m_pitchProb;
     vector<Vamp::RealTime> m_timestamp;
 };