ref: 7e9e31189b9896cc300b949e0ca575d9e5232909
parent: 35f73b8cda047d1115dec4efe967a8bed0f44020
author: Paul Brossier <piem@piem.org>
date: Fri Mar 15 13:49:29 EDT 2013
python/demos/demo_onset*: remove di, moved to C
--- a/python/demos/demo_onset.py
+++ b/python/demos/demo_onset.py
@@ -20,10 +20,6 @@
o = onset("default", win_s, hop_s, samplerate)
-# onset detection delay, in samples
-# default to 4 blocks delay to catch up with
-delay = 4. * hop_s
-
# list of onsets, in samples
onsets = []
@@ -31,11 +27,9 @@
total_frames = 0
while True:
samples, read = s()
- is_onset = o(samples)
- if is_onset:
- this_onset = int(total_frames - delay + is_onset[0] * hop_s)
- print "%f" % (this_onset / float(samplerate))
- onsets.append(this_onset)
+ if o(samples):
+ print "%f" % o.get_last_onset_s()
+ onsets.append(o.get_last_onset())
total_frames += read
if read < hop_s: break
#print len(onsets)
--- a/python/demos/demo_onset_plot.py
+++ b/python/demos/demo_onset_plot.py
@@ -20,10 +20,6 @@
samplerate = s.samplerate
o = onset("default", win_s, hop_s, samplerate)
-# onset detection delay, in samples
-# default to 4 blocks delay to catch up with
-delay = 4. * hop_s
-
# list of onsets, in samples
onsets = []
@@ -39,7 +35,7 @@
samples, read = s()
is_onset = o(samples)
if is_onset:
- this_onset = int(total_frames - delay + is_onset[0] * hop_s)
+ this_onset = o.get_last_onset()
print "%f" % (this_onset / float(samplerate))
onsets.append(this_onset)
# keep some data to plot it later