Showing the changes to python (1 of 1 file). Show all
Unified · Split
| @@ -15,7 +15,6 @@ if len(sys.argv) < 2: · 14 unmodified lines | |||
| 15 | 15 | ||
| 16 | filename = sys.argv[1] | 16 | filename = sys.argv[1] |
| 17 | onsets = [] | 17 | onsets = [] |
| 18 | oldonsets = [] | ||
| 19 | 18 | ||
| 20 | s = source(filename, samplerate, hop_s) | 19 | s = source(filename, samplerate, hop_s) |
| 21 | o = onset("default", win_s, hop_s) | 20 | o = onset("default", win_s, hop_s) |
| @@ -31,9 +30,6 @@ while True: · 9 unmodified lines | |||
| 31 | thisbeat = (block_read - 4. + isbeat[0]) * hop_s / samplerate | 30 | thisbeat = (block_read - 4. + isbeat[0]) * hop_s / samplerate |
| 32 | print "%.4f" % thisbeat | 31 | print "%.4f" % thisbeat |
| 33 | onsets.append (thisbeat) | 32 | onsets.append (thisbeat) |
| 34 | # old onset | ||
| 35 | thisbeat = (block_read - 3. ) * hop_s / samplerate | ||
| 36 | oldonsets.append (thisbeat) | ||
| 37 | block_read += 1 | 33 | block_read += 1 |
| 38 | if read < hop_s: break | 34 | if read < hop_s: break |
| 39 | 35 | ||
| @@ -46,7 +42,6 @@ plot(allsamples_max_times, allsamples_max, '-b') · 6 unmodified lines | |||
| 46 | plot(allsamples_max_times, -allsamples_max, '-b') | 42 | plot(allsamples_max_times, -allsamples_max, '-b') |
| 47 | axis(xmin = 0., xmax = max(allsamples_max_times) ) | 43 | axis(xmin = 0., xmax = max(allsamples_max_times) ) |
| 48 | for stamp in onsets: plot([stamp, stamp], [-1., 1.], '.-r') | 44 | for stamp in onsets: plot([stamp, stamp], [-1., 1.], '.-r') |
| 49 | for stamp in oldonsets: plot([stamp, stamp], [-1., 1.], '.-g') | ||
| 50 | xlabel('time (s)') | 45 | xlabel('time (s)') |
| 51 | ylabel('amplitude') | 46 | ylabel('amplitude') |
| 52 | show() | 47 | show() |