History

demos/demo_onset_file.py: indent, hide y-axis

Paul Brossier committed 13 years ago

Commit 129b2691 parent 9f8e8a91 file · +25 −23Browse files

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

Unified · Split

python/demos/demo_onset_file.py+25−23
@@ -38,26 +38,28 @@ while True: · 37 unmodified lines
38 block_read += 138 block_read += 1
39 if read < hop_s: break39 if read < hop_s: break
40 40
41# do plotting41if 1:
42from numpy import arange42 # do plotting
43import matplotlib.pyplot as plt43 from numpy import arange
44allsamples_max = (allsamples_max > 0) * allsamples_max44 import matplotlib.pyplot as plt
45allsamples_max_times = [ float(t) * hop_s / downsample / samplerate for t in range(len(allsamples_max)) ]45 allsamples_max = (allsamples_max > 0) * allsamples_max
46plt1 = plt.axes([0.1, 0.75, 0.8, 0.19])46 allsamples_max_times = [ float(t) * hop_s / downsample / samplerate for t in range(len(allsamples_max)) ]
47plt2 = plt.axes([0.1, 0.1, 0.8, 0.65], sharex = plt1)47 plt1 = plt.axes([0.1, 0.75, 0.8, 0.19])
48plt.rc('lines',linewidth='.8')48 plt2 = plt.axes([0.1, 0.1, 0.8, 0.65], sharex = plt1)
49plt1.plot(allsamples_max_times, allsamples_max, '-b')49 plt.rc('lines',linewidth='.8')
50plt1.plot(allsamples_max_times, -allsamples_max, '-b')50 plt1.plot(allsamples_max_times, allsamples_max, '-b')
51for stamp in onsets: plt1.plot([stamp, stamp], [-1., 1.], '-r')51 plt1.plot(allsamples_max_times, -allsamples_max, '-b')
52plt1.axis(xmin = 0., xmax = max(allsamples_max_times) )52 for stamp in onsets: plt1.plot([stamp, stamp], [-1., 1.], '-r')
53plt1.xaxis.set_visible(False)53 plt1.axis(xmin = 0., xmax = max(allsamples_max_times) )
54desc_times = [ float(t) * hop_s / samplerate for t in range(len(desc)) ]54 plt1.xaxis.set_visible(False)
55desc_plot = [d / max(desc) for d in desc]55 plt1.yaxis.set_visible(False)
56plt2.plot(desc_times, desc_plot, '-g')56 desc_times = [ float(t) * hop_s / samplerate for t in range(len(desc)) ]
57tdesc_plot = [d / max(desc) for d in tdesc]57 desc_plot = [d / max(desc) for d in desc]
58for stamp in onsets: plt2.plot([stamp, stamp], [min(tdesc_plot), max(desc_plot)], '-r')58 plt2.plot(desc_times, desc_plot, '-g')
59plt2.plot(desc_times, tdesc_plot, '-y')59 tdesc_plot = [d / max(desc) for d in tdesc]
60plt2.axis(ymin = min(tdesc_plot), ymax = max(desc_plot))60 for stamp in onsets: plt2.plot([stamp, stamp], [min(tdesc_plot), max(desc_plot)], '-r')
61plt.xlabel('time (s)')61 plt2.plot(desc_times, tdesc_plot, '-y')
62#plt.savefig('/tmp/t.png', dpi=200)62 plt2.axis(ymin = min(tdesc_plot), ymax = max(desc_plot))
63plt.show()63 plt.xlabel('time (s)')
64 #plt.savefig('/tmp/t.png', dpi=200)
65 plt.show()

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