]> git.sesse.net Git - pitch/blobdiff - pitch.cpp
Fix another missing #include of string.h.
[pitch] / pitch.cpp
index 933fef9aacc97896dc108dd2466ecbb85f23f8e3..12cf6d8cb8ddfdcb2d092d494255c2e60a67edc5 100644 (file)
--- a/pitch.cpp
+++ b/pitch.cpp
@@ -1,4 +1,5 @@
 #include <stdio.h>
+#include <string.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <fcntl.h>
@@ -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