Make a fine tuning display for the guitar; useful to get it "just right".
authorsgunderson@bigfoot.com <>
Sun, 4 Feb 2007 14:27:52 +0000 (15:27 +0100)
committersgunderson@bigfoot.com <>
Sun, 4 Feb 2007 14:27:52 +0000 (15:27 +0100)
pitch.cpp

index 933fef9..3a04fa9 100644 (file)
--- 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);
 
 
        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("#");
        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
        printf("]\n");
 }
 #endif