From 897b45557fdcc0a0c903513405553debdf8f7a7a Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Sun, 26 Feb 2006 17:29:23 +0000 Subject: [PATCH] added support for dcthreshold added support for dcthreshold --- python/aubio/aubioclass.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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: -- 2.26.2