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