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