History

python/demos/demo_pitch.py: remove stdout, plot in midi

Paul Brossier committed 11 years ago

Commit 193dcbb1 parent 9e54b831 file · +4 −4Browse files

Showing the changes to python (1 of 1 file). Show all

Unified · Split

python/demos/demo_pitch.py+4−4
@@ -22,7 +22,7 @@ samplerate = s.samplerate · 21 unmodified lines
2222 tolerance = 0.8
2323
2424 pitch_o = pitch("yin", win_s, hop_s, samplerate)
25−pitch_o.set_unit("freq")
25+pitch_o.set_unit("midi")
2626 pitch_o.set_tolerance(tolerance)
2727
2828 pitches = []
@@ -36,7 +36,7 @@ while True: · 7 unmodified lines
3636 #pitch = int(round(pitch))
3737 confidence = pitch_o.get_confidence()
3838 #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)
4040 pitches += [pitch]
4141 confidences += [confidence]
4242 total_frames += read
@@ -80,7 +80,7 @@ if os.path.isfile(ground_truth): · 37 unmodified lines
8080 ax2.plot(true_times, true_freqs, 'r')
8181 ax2.axis( ymin = 0.9 * true_freqs.min(), ymax = 1.1 * true_freqs.max() )
8282 # plot raw pitches
83−ax2.plot(times, pitches, '--g')
83+ax2.plot(times, pitches, '.g')
8484 # plot cleaned up pitches
8585 cleaned_pitches = pitches
8686 #cleaned_pitches = ma.masked_where(cleaned_pitches < 0, cleaned_pitches)
@@ -90,7 +90,7 @@ ax2.plot(times, cleaned_pitches, '.-') · 3 unmodified lines
9090 #ax2.axis( ymin = 0.9 * cleaned_pitches.min(), ymax = 1.1 * cleaned_pitches.max() )
9191 #ax2.axis( ymin = 55, ymax = 70 )
9292 plt.setp(ax2.get_xticklabels(), visible = False)
93−ax2.set_ylabel('f0 (Hz)')
93+ax2.set_ylabel('f0 (midi)')
9494
9595 # plot confidence
9696 ax3 = fig.add_subplot(313, sharex = ax1)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t