From: Paul Brossier Date: Sun, 26 Feb 2006 17:29:23 +0000 (+0000) Subject: added support for dcthreshold X-Git-Tag: bzr2git~759 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=897b45557fdcc0a0c903513405553debdf8f7a7a;p=aubio.git added support for dcthreshold added support for dcthreshold --- diff --git a/python/aubio/aubioclass.py b/python/aubio/aubioclass.py index 4d5ff5f6..6c518eab 100644 --- a/python/aubio/aubioclass.py +++ b/python/aubio/aubioclass.py @@ -77,7 +77,7 @@ class peakpick: 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 @@ class onsetpick: self.mode = mode self.pp = peakpick(float(threshold)) self.derivate = derivate + self.dcthreshold = dcthreshold self.oldval = 0. def do(self,myvec): @@ -105,6 +106,10 @@ class onsetpick: 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) class pitchdetection: