]> git.sesse.net Git - pitch/commitdiff
Start a bit above DC, to combat microphones with huge low-frequency content.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 28 Apr 2006 12:14:28 +0000 (12:14 +0000)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 28 Apr 2006 12:14:28 +0000 (12:14 +0000)
pitch.cpp

index eac947c775c4001e558dac01e156f1928fb0c0e9..36be752bbd66e87163e71921348a95644ebf8b6b 100644 (file)
--- a/pitch.cpp
+++ b/pitch.cpp
@@ -190,10 +190,10 @@ void find_peak_magnitudes(std::complex<double> *in, double *out, unsigned num_sa
 
 std::pair<double, double> find_peak(double *in, unsigned num_samples)
 {
 
 std::pair<double, double> find_peak(double *in, unsigned num_samples)
 {
-       double best_peak = in[0];
-       unsigned best_bin = 0;
+       double best_peak = in[5];
+       unsigned best_bin = 5;
 
 
-       for (unsigned i = 1; i < num_samples / 2 + 1; ++i) {
+       for (unsigned i = 6; i < num_samples / 2 + 1; ++i) {
                if (in[i] > best_peak) {
                        best_peak = in[i];
                        best_bin = i;
                if (in[i] > best_peak) {
                        best_peak = in[i];
                        best_bin = i;