From 7e9e31189b9896cc300b949e0ca575d9e5232909 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Fri, 15 Mar 2013 17:49:29 -0500 Subject: [PATCH] python/demos/demo_onset*: remove di, moved to C --- python/demos/demo_onset.py | 12 +++--------- python/demos/demo_onset_plot.py | 6 +----- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/python/demos/demo_onset.py b/python/demos/demo_onset.py index d921724e..170326fc 100755 --- a/python/demos/demo_onset.py +++ b/python/demos/demo_onset.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 = [] @@ -31,11 +27,9 @@ onsets = [] 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) diff --git a/python/demos/demo_onset_plot.py b/python/demos/demo_onset_plot.py index 513c579d..246b5b14 100755 --- a/python/demos/demo_onset_plot.py +++ b/python/demos/demo_onset_plot.py @@ -20,10 +20,6 @@ s = source(filename, samplerate, hop_s) 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 @@ while True: 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 -- 2.26.2