# HG changeset patch # User Chris Cannam # Date 1341869503 -3600 # Node ID 8a77e4de0d4696a7144e075f85d944a1556acb1f # Parent 1c1e950047948f241f76faa06369024176e63ba8 More tweaking with thresholds and confidences -- but I feel like this is going in the wrong direction diff -r 1c1e95004794 -r 8a77e4de0d46 CepstrumPitchTracker.cpp --- 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;