From: Paul Brossier Date: Tue, 26 May 2015 09:01:57 +0000 (+0200) Subject: python/demos/demo_pitch.py: remove stdout, plot in midi X-Git-Tag: 0.4.2~33 X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=193dcbb9a1412067b126aeffaf84bb66ee7027ba;p=aubio.git python/demos/demo_pitch.py: remove stdout, plot in midi --- diff --git a/python/demos/demo_pitch.py b/python/demos/demo_pitch.py index 81f17cd4..2eb9ba7b 100755 --- a/python/demos/demo_pitch.py +++ b/python/demos/demo_pitch.py @@ -22,7 +22,7 @@ samplerate = s.samplerate 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 = [] @@ -36,7 +36,7 @@ while True: #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 @@ -80,7 +80,7 @@ if os.path.isfile(ground_truth): 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) @@ -90,7 +90,7 @@ ax2.plot(times, 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)