From: sgunderson@bigfoot.com <> Date: Tue, 5 Feb 2008 01:53:19 +0000 (+0100) Subject: Don't choose impossible tones as undertones. X-Git-Url: https://git.sesse.net/index.cgi/?p=pitch;a=commitdiff_plain;h=afe882f57eb4991f01b20c4ecba98b2cc07594a1 Don't choose impossible tones as undertones. --- diff --git a/pitchdetector.cpp b/pitchdetector.cpp index 02c7035..6988864 100644 --- a/pitchdetector.cpp +++ b/pitchdetector.cpp @@ -107,7 +107,8 @@ std::pair PitchDetector::find_peak(double *in, unsigned num_samp // see if we might have hit an overtone (set a limit of 10dB) for (unsigned i = 6; i >= 1; --i) { if (best_bin != best_bin / i && - 20.0 * log10(in[best_bin] / in[best_bin / i]) < 10.0f) { + 20.0 * log10(in[best_bin] / in[best_bin / i]) < 10.0f && + best_bin / i >= 5) { #if 0 printf("Overtone of degree %u!\n", i); #endif