History

added support for dcthreshold added support for dcthreshold

Paul Brossier committed 20 years ago

Commit 897b4551 parent ee7b9da1 file · +6 −1Browse files

Showing the changes to python (1 of 1 file). Show all

Unified · Split

python/aubio/aubioclass.py+6−1
@@ -77,7 +77,7 @@ class peakpick: · 76 unmodified lines
77 77
78class onsetpick:78class onsetpick:
79 """ superclass for aubio_pvoc + aubio_onsetdetection + aubio_peakpicker """79 """ superclass for aubio_pvoc + aubio_onsetdetection + aubio_peakpicker """
80 def __init__(self,bufsize,hopsize,channels,myvec,threshold,mode='dual',derivate=False):80 def __init__(self,bufsize,hopsize,channels,myvec,threshold,mode='dual',derivate=False,dcthreshold=0):
81 self.myfft = cvec(bufsize,channels)81 self.myfft = cvec(bufsize,channels)
82 self.pv = pvoc(bufsize,hopsize,channels)82 self.pv = pvoc(bufsize,hopsize,channels)
83 if mode in ['dual'] :83 if mode in ['dual'] :
@@ -91,6 +91,7 @@ class onsetpick: · 7 unmodified lines
91 self.mode = mode91 self.mode = mode
92 self.pp = peakpick(float(threshold))92 self.pp = peakpick(float(threshold))
93 self.derivate = derivate93 self.derivate = derivate
94 self.dcthreshold = dcthreshold
94 self.oldval = 0.95 self.oldval = 0.
95 96
96 def do(self,myvec): 97 def do(self,myvec):
@@ -105,6 +106,10 @@ class onsetpick: · 8 unmodified lines
105 self.oldval = val106 self.oldval = val
106 if dval > 0: self.myonset.set(dval,0,0)107 if dval > 0: self.myonset.set(dval,0,0)
107 else: self.myonset.set(0.,0,0)108 else: self.myonset.set(0.,0,0)
109 if self.dcthreshold:
110 dval = self.myonset.get(0,0) - self.dcthreshold
111 if dval > 0: self.myonset.set(dval,0,0)
112 else: self.myonset.set(0.,0,0)
108 return self.pp.do(self.myonset),self.myonset.get(0,0)113 return self.pp.do(self.myonset),self.myonset.get(0,0)
109 114
110class pitchdetection:115class pitchdetection:

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t