# HG changeset patch # User Chris Cannam # Date 1341691597 -3600 # Node ID 44bb93cae2882d8f32cb5a7f45c01f221d55f490 # Parent a15d8c89a36e701e3fe58e955905f8de6ce92331 Change peak-to-next-peak ratio to a difference (because difference of peaks in log values don't vary with signal amplification) diff -r a15d8c89a36e -r 44bb93cae288 CepstrumPitchTracker.cpp --- a/CepstrumPitchTracker.cpp Thu Jul 05 21:54:50 2012 +0100 +++ b/CepstrumPitchTracker.cpp Sat Jul 07 21:06:37 2012 +0100 @@ -530,12 +530,6 @@ filter(rawcep, data); delete[] rawcep; - double abstot = 0.0; - - for (int i = 0; i < n; ++i) { - abstot += fabs(data[i]); - } - double maxval = 0.0; int maxbin = -1; @@ -566,7 +560,7 @@ double confidence = 0.0; if (nextPeakVal != 0.0) { - confidence = ((maxval / nextPeakVal) - 1.0) / 4.0; + confidence = (maxval - nextPeakVal) / 200.0; if (confidence > 1.0) confidence = 1.0; } diff -r a15d8c89a36e -r 44bb93cae288 SimpleCepstrum.cpp --- a/SimpleCepstrum.cpp Thu Jul 05 21:54:50 2012 +0100 +++ b/SimpleCepstrum.cpp Sat Jul 07 21:06:37 2012 +0100 @@ -306,9 +306,9 @@ outputs.push_back(d); d.identifier = "peak_to_second_peak"; - d.name = "Peak to second-peak ratio"; + d.name = "Peak to second-peak difference"; d.unit = ""; - d.description = "Return the ratio of the value found in the peak bin within the specified range of the cepstrum, to the value found in the next highest peak"; + d.description = "Return the difference between the value found in the peak bin within the specified range of the cepstrum, and that found in the next highest peak"; m_pkoOutput = n++; outputs.push_back(d); @@ -616,7 +616,7 @@ Feature pko; if (nextPeakVal != 0.0) { - pko.values.push_back(maxval / nextPeakVal); + pko.values.push_back(maxval - nextPeakVal); } else { pko.values.push_back(0.0); }