changeset 29:8a77e4de0d46

More tweaking with thresholds and confidences -- but I feel like this is going in the wrong direction
author Chris Cannam
date Mon, 09 Jul 2012 22:31:43 +0100
parents 1c1e95004794
children 6e176b8d1572
files CepstrumPitchTracker.cpp
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/CepstrumPitchTracker.cpp	Sun Jul 08 10:39:14 2012 +0100
+++ b/CepstrumPitchTracker.cpp	Mon Jul 09 22:31:43 2012 +0100
@@ -525,6 +525,8 @@
     delete[] logmag;
     delete[] io;
 
+    double cep1 = rawcep[1];
+
     int n = m_bins;
     double *data = new double[n];
     filter(rawcep, data);
@@ -560,8 +562,13 @@
 
     double confidence = 0.0;
     if (nextPeakVal != 0.0) {
-        confidence = (maxval - nextPeakVal) / 200.0;
-        if (confidence > 1.0) confidence = 1.0;
+        std::cerr << "maxval = " << maxval << ", cep1 = " << cep1 << std::endl;
+        double conf0 = (maxval - nextPeakVal) / 80.0;
+        double conf1 = (cep1 / bs) / 2;
+        if (conf0 > 1.0) conf0 = 1.0;
+        if (conf1 > 1.0) conf1 = 1.0;
+        confidence = conf0 * conf1;
+        std::cerr << "conf0 = " << conf0 << ", conf1 = " << conf1 << ", confidence = " << confidence << std::endl;
     }
 
     Hypothesis::Estimate e;