Showing the changes to python (1 of 1 file). Show all
Unified · Split
| @@ -22,7 +22,7 @@ samplerate = s.samplerate · 21 unmodified lines | ||
| 22 | 22 | tolerance = 0.8 |
| 23 | 23 | |
| 24 | 24 | pitch_o = pitch("yin", win_s, hop_s, samplerate) |
| 25 | −pitch_o.set_unit("freq") | |
| 25 | +pitch_o.set_unit("midi") | |
| 26 | 26 | pitch_o.set_tolerance(tolerance) |
| 27 | 27 | |
| 28 | 28 | pitches = [] |
| @@ -36,7 +36,7 @@ while True: · 7 unmodified lines | ||
| 36 | 36 | #pitch = int(round(pitch)) |
| 37 | 37 | confidence = pitch_o.get_confidence() |
| 38 | 38 | #if confidence < 0.8: pitch = 0. |
| 39 | − print "%f %f %f" % (total_frames / float(samplerate), pitch, confidence) | |
| 39 | + #print "%f %f %f" % (total_frames / float(samplerate), pitch, confidence) | |
| 40 | 40 | pitches += [pitch] |
| 41 | 41 | confidences += [confidence] |
| 42 | 42 | total_frames += read |
| @@ -80,7 +80,7 @@ if os.path.isfile(ground_truth): · 37 unmodified lines | ||
| 80 | 80 | ax2.plot(true_times, true_freqs, 'r') |
| 81 | 81 | ax2.axis( ymin = 0.9 * true_freqs.min(), ymax = 1.1 * true_freqs.max() ) |
| 82 | 82 | # plot raw pitches |
| 83 | −ax2.plot(times, pitches, '--g') | |
| 83 | +ax2.plot(times, pitches, '.g') | |
| 84 | 84 | # plot cleaned up pitches |
| 85 | 85 | cleaned_pitches = pitches |
| 86 | 86 | #cleaned_pitches = ma.masked_where(cleaned_pitches < 0, cleaned_pitches) |
| @@ -90,7 +90,7 @@ ax2.plot(times, cleaned_pitches, '.-') · 3 unmodified lines | ||
| 90 | 90 | #ax2.axis( ymin = 0.9 * cleaned_pitches.min(), ymax = 1.1 * cleaned_pitches.max() ) |
| 91 | 91 | #ax2.axis( ymin = 55, ymax = 70 ) |
| 92 | 92 | plt.setp(ax2.get_xticklabels(), visible = False) |
| 93 | −ax2.set_ylabel('f0 (Hz)') | |
| 93 | +ax2.set_ylabel('f0 (midi)') | |
| 94 | 94 | |
| 95 | 95 | # plot confidence |
| 96 | 96 | ax3 = fig.add_subplot(313, sharex = ax1) |