From: sgunderson@bigfoot.com <> Date: Sun, 4 Feb 2007 14:27:52 +0000 (+0100) Subject: Make a fine tuning display for the guitar; useful to get it "just right". X-Git-Url: https://git.sesse.net/?p=pitch;a=commitdiff_plain;h=24d0e4fa9a93f86fffd7bca85510973c97dc0dec;ds=sidebyside Make a fine tuning display for the guitar; useful to get it "just right". --- 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