From: Paul Brossier Date: Thu, 8 Oct 2009 18:59:23 +0000 (+0200) Subject: python/aubio: update to latest pitch prototypes X-Git-Tag: bzr2git~150 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3027c6eb39507962924312c49a8f1e49fb542922;p=aubio.git python/aubio: update to latest pitch prototypes --- diff --git a/python/aubio/aubioclass.py b/python/aubio/aubioclass.py index 0a5f702d..18f6ce16 100644 --- a/python/aubio/aubioclass.py +++ b/python/aubio/aubioclass.py @@ -125,16 +125,17 @@ class onsetpick: 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): diff --git a/python/aubio/task/pitch.py b/python/aubio/task/pitch.py index a531a62b..1db00b3b 100644 --- a/python/aubio/task/pitch.py +++ b/python/aubio/task/pitch.py @@ -7,19 +7,19 @@ class taskpitch(task): 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