tolerance = 0.8
pitch_o = pitch("yin", win_s, hop_s, samplerate)
-pitch_o.set_unit("freq")
+pitch_o.set_unit("midi")
pitch_o.set_tolerance(tolerance)
pitches = []
#pitch = int(round(pitch))
confidence = pitch_o.get_confidence()
#if confidence < 0.8: pitch = 0.
- print "%f %f %f" % (total_frames / float(samplerate), pitch, confidence)
+ #print "%f %f %f" % (total_frames / float(samplerate), pitch, confidence)
pitches += [pitch]
confidences += [confidence]
total_frames += read
ax2.plot(true_times, true_freqs, 'r')
ax2.axis( ymin = 0.9 * true_freqs.min(), ymax = 1.1 * true_freqs.max() )
# plot raw pitches
-ax2.plot(times, pitches, '--g')
+ax2.plot(times, pitches, '.g')
# plot cleaned up pitches
cleaned_pitches = pitches
#cleaned_pitches = ma.masked_where(cleaned_pitches < 0, cleaned_pitches)
#ax2.axis( ymin = 0.9 * cleaned_pitches.min(), ymax = 1.1 * cleaned_pitches.max() )
#ax2.axis( ymin = 55, ymax = 70 )
plt.setp(ax2.get_xticklabels(), visible = False)
-ax2.set_ylabel('f0 (Hz)')
+ax2.set_ylabel('f0 (midi)')
# plot confidence
ax3 = fig.add_subplot(313, sharex = ax1)