History

demos/demo_onset_file.py: remove old onsets

Paul Brossier committed 13 years ago

Commit b0d5a481 parent cf80e591 file · +0 −5Browse files

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

Unified · Split

python/demos/demo_onset_file.py+0−5
@@ -15,7 +15,6 @@ if len(sys.argv) < 2: · 14 unmodified lines
15 15
16filename = sys.argv[1]16filename = sys.argv[1]
17onsets = []17onsets = []
18oldonsets = []
19 18
20s = source(filename, samplerate, hop_s)19s = source(filename, samplerate, hop_s)
21o = onset("default", win_s, hop_s)20o = onset("default", win_s, hop_s)
@@ -31,9 +30,6 @@ while True: · 9 unmodified lines
31 thisbeat = (block_read - 4. + isbeat[0]) * hop_s / samplerate30 thisbeat = (block_read - 4. + isbeat[0]) * hop_s / samplerate
32 print "%.4f" % thisbeat31 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 += 133 block_read += 1
38 if read < hop_s: break34 if read < hop_s: break
39 35
@@ -46,7 +42,6 @@ plot(allsamples_max_times, allsamples_max, '-b') · 6 unmodified lines
46plot(allsamples_max_times, -allsamples_max, '-b')42plot(allsamples_max_times, -allsamples_max, '-b')
47axis(xmin = 0., xmax = max(allsamples_max_times) )43axis(xmin = 0., xmax = max(allsamples_max_times) )
48for stamp in onsets: plot([stamp, stamp], [-1., 1.], '.-r')44for stamp in onsets: plot([stamp, stamp], [-1., 1.], '.-r')
49for stamp in oldonsets: plot([stamp, stamp], [-1., 1.], '.-g')
50xlabel('time (s)')45xlabel('time (s)')
51ylabel('amplitude')46ylabel('amplitude')
52show()47show()

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