ref: 897b45557fdcc0a0c903513405553debdf8f7a7a
parent: ee7b9da61315625e941704bce48a035de4d63618
author: Paul Brossier <piem@altern.org>
date: Sun Feb 26 12:29:23 EST 2006
added support for dcthreshold added support for dcthreshold
--- a/python/aubio/aubioclass.py
+++ b/python/aubio/aubioclass.py
@@ -77,7 +77,7 @@
class onsetpick:
""" superclass for aubio_pvoc + aubio_onsetdetection + aubio_peakpicker """
- def __init__(self,bufsize,hopsize,channels,myvec,threshold,mode='dual',derivate=False):
+ def __init__(self,bufsize,hopsize,channels,myvec,threshold,mode='dual',derivate=False,dcthreshold=0):
self.myfft = cvec(bufsize,channels)
self.pv = pvoc(bufsize,hopsize,channels)
if mode in ['dual'] :
@@ -91,6 +91,7 @@
self.mode = mode
self.pp = peakpick(float(threshold))
self.derivate = derivate
+ self.dcthreshold = dcthreshold
self.oldval = 0.
def do(self,myvec):
@@ -103,6 +104,10 @@
val = self.myonset.get(0,0)
dval = val - self.oldval
self.oldval = val
+ if dval > 0: self.myonset.set(dval,0,0)
+ else: self.myonset.set(0.,0,0)
+ if self.dcthreshold:
+ dval = self.myonset.get(0,0) - self.dcthreshold
if dval > 0: self.myonset.set(dval,0,0)
else: self.myonset.set(0.,0,0)
return self.pp.do(self.myonset),self.myonset.get(0,0)