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