shithub: aubio

Download patch

ref: 3027c6eb39507962924312c49a8f1e49fb542922
parent: 61316a6f46a4313d6e200a11211cbd37e0155fd6
author: Paul Brossier <piem@piem.org>
date: Thu Oct 8 16:59:23 EDT 2009

python/aubio: update to latest pitch prototypes

--- a/python/aubio/aubioclass.py
+++ b/python/aubio/aubioclass.py
@@ -125,16 +125,17 @@
 
 class pitchdetection:
     def __init__(self,mode=aubio_pitch_mcomb,bufsize=2048,hopsize=1024,
-        channels=1,samplerate=44100.,omode=aubio_pitchm_freq,yinthresh=0.1):
+        channels=1,samplerate=44100.,omode=aubio_pitchm_freq,tolerance=0.1):
         self.pitchp = new_aubio_pitchdetection(bufsize,hopsize,channels,
                 samplerate,mode,omode)
-        aubio_pitchdetection_set_yinthresh(self.pitchp,yinthresh)
+        self.mypitch = fvec(1, channels)
+        aubio_pitchdetection_set_tolerance(self.pitchp,tolerance)
         #self.filt     = filter(srate,"adsgn")
     def __del__(self):
         del_aubio_pitchdetection(self.pitchp)
     def __call__(self,myvec): 
-        #self.filt(myvec)
-        return aubio_pitchdetection_do(self.pitchp,myvec())
+        aubio_pitchdetection_do(self.pitchp,myvec(), self.mypitch())
+        return self.mypitch.get(0,0)
 
 class filter:
     def __init__(self,srate,type=None):
--- a/python/aubio/task/pitch.py
+++ b/python/aubio/task/pitch.py
@@ -7,19 +7,19 @@
 	def __init__(self,input,params=None):
 		task.__init__(self,input,params=params)
 		self.shortlist = [0. for i in range(self.params.pitchsmooth)]
-		if self.params.pitchmode == 'yinfft':
-			yinthresh = self.params.yinfftthresh
-		elif self.params.pitchmode == 'yin':
-			yinthresh = self.params.yinthresh
+		if self.params.pitchmode == 'yin':
+			tolerance = self.params.yinthresh
+		elif self.params.pitchmode == 'yinfft':
+			tolerance = self.params.yinfftthresh
 		else:
-			yinthresh = 0.
-		self.pitchdet  = pitchdetection(mode=get_pitch_mode(self.params.pitchmode),
+			tolerance = 0.
+		self.pitchdet	= pitchdetection(mode=get_pitch_mode(self.params.pitchmode),
 			bufsize=self.params.bufsize,
 			hopsize=self.params.hopsize,
 			channels=self.channels,
 			samplerate=self.srate,
 			omode=self.params.omode,
-			yinthresh=yinthresh)
+			tolerance = tolerance)
 
 	def __call__(self):
 		from aubio.median import short_find