From 24d0e4fa9a93f86fffd7bca85510973c97dc0dec Mon Sep 17 00:00:00 2001 From: "sgunderson@bigfoot.com" <> Date: Sun, 4 Feb 2007 15:27:52 +0100 Subject: [PATCH 1/1] Make a fine tuning display for the guitar; useful to get it "just right". --- pitch.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pitch.cpp b/pitch.cpp index 933fef9..3a04fa9 100644 --- a/pitch.cpp +++ b/pitch.cpp @@ -202,6 +202,7 @@ void print_spectrogram(double freq, double amp) printf(" (%s %+.2f, %5.2fHz) [%5.2fdB] [", notes[best_away_ind].notename, best_away, freq, amp); + // coarse tuning for (int i = -10; i <= 10; ++i) { if (best_away >= (i-0.5) * 0.05 && best_away < (i+0.5) * 0.05) { printf("#"); @@ -213,6 +214,20 @@ void print_spectrogram(double freq, double amp) } } } + printf("] ["); + + // fine tuning + for (int i = -10; i <= 10; ++i) { + if (best_away >= (i-0.5) * 0.01 && best_away < (i+0.5) * 0.01) { + printf("#"); + } else { + if (i == 0) { + printf("|"); + } else { + printf("-"); + } + } + } printf("]\n"); } #endif -- 2.39.2