From: Steinar H. Gunderson Date: Fri, 28 Apr 2006 12:09:17 +0000 (+0000) Subject: Fix lower limit for overtone detection. X-Git-Url: https://git.sesse.net/?p=pitch;a=commitdiff_plain;h=67bcecfdd519329d303d315e08733d1d27db6225;ds=sidebyside Fix lower limit for overtone detection. --- diff --git a/pitch.cpp b/pitch.cpp index 91afda5..eac947c 100644 --- a/pitch.cpp +++ b/pitch.cpp @@ -259,6 +259,8 @@ std::pair adjust_for_overtones(std::pair base, d unsigned middle = unsigned(floor(freq_to_bin(base.first, num_samples) * i + 0.5)); unsigned lower = middle - (i+1)/2, upper = middle + (i+1)/2; + if (lower < 1) + lower = 1; if (upper >= num_samples) upper = num_samples - 2;