X-Git-Url: https://git.sesse.net/?p=pitch;a=blobdiff_plain;f=pitch.cpp;h=12cf6d8cb8ddfdcb2d092d494255c2e60a67edc5;hp=933fef9aacc97896dc108dd2466ecbb85f23f8e3;hb=fa1b9cdf79b7688a8fec21e3a13eb8d8e6505391;hpb=66156de8eb723c104b616223f8ca7cc20ea55d05 diff --git a/pitch.cpp b/pitch.cpp index 933fef9..12cf6d8 100644 --- a/pitch.cpp +++ b/pitch.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -202,6 +203,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 +215,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