# HG changeset patch # User Chris Cannam # Date 1341869503 -3600 # Node ID 0a0e449a60698e922522f3230a00e86e227f4df5 # Parent bb534ad603b60f26ede5feeab87ad4a3a632c8c1 More tweaking with thresholds and confidences -- but I feel like this is going in the wrong direction diff -r bb534ad603b6 -r 0a0e449a6069 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;