shithub: aubio

Download patch

ref: 422edfb832893f93b9e17a78c25788950c84a028
parent: 020d80eddd93e01ae1193f1593e89ffd3393967e
author: Paul Brossier <piem@piem.org>
date: Tue Oct 6 13:02:54 EDT 2009

src/onset/peakpick.h: clean up peakpicker object

--- a/src/onset/onset.c
+++ b/src/onset/onset.c
@@ -50,7 +50,7 @@
     aubio_onsetdetection(o2,fftgrain, onset2);
     onset->data[0][0] *= onset2->data[0][0];
   }*/
-  isonset = aubio_peakpick_pimrt(o->of,o->pp);
+  isonset = aubio_peakpicker_do(o->pp, o->of);
   if (isonset > 0.) {
     if (aubio_silence_detection(input, o->silence)==1) {
       isonset  = 0;
--- a/src/onset/peakpick.c
+++ b/src/onset/peakpick.c
@@ -67,7 +67,7 @@
 /** modified version for real time, moving mean adaptive threshold this method
  * is slightly more permissive than the offline one, and yelds to an increase
  * of false positives. best  */
-smpl_t aubio_peakpick_pimrt(fvec_t * onset,  aubio_pickpeak_t * p) {
+smpl_t aubio_peakpicker_do(aubio_pickpeak_t * p, fvec_t * onset) {
 	fvec_t * onset_keep = (fvec_t *)p->onset_keep;
 	fvec_t * onset_proc = (fvec_t *)p->onset_proc;
 	fvec_t * onset_peek = (fvec_t *)p->onset_peek;
@@ -120,25 +120,12 @@
 /** this method returns the current value in the pick peaking buffer
  * after smoothing
  */
-smpl_t aubio_peakpick_pimrt_getval(aubio_pickpeak_t * p) 
+smpl_t aubio_peakpicker_get_thresholded_input(aubio_pickpeak_t * p) 
 {
-	uint_t i = 0;
-	return p->onset_peek->data[i][1];
+	return p->onset_peek->data[0][1];
 }
 
 /** function added by Miguel Ramirez to return the onset detection amplitude in peakval */
-uint_t aubio_peakpick_pimrt_wt(fvec_t * onset,  aubio_pickpeak_t * p, smpl_t* peakval) 
-{
-	uint_t isonset = 0;
-	isonset = aubio_peakpick_pimrt(onset,p);
-
-	//if ( isonset && peakval != NULL )
-	if ( peakval != NULL )
-		*peakval = aubio_peakpick_pimrt_getval(p); 
-
-	return isonset;
-}
-
 void aubio_peakpicker_set_threshold(aubio_pickpeak_t * p, smpl_t threshold) {
 	p->threshold = threshold;
 	return;
--- a/src/onset/peakpick.h
+++ b/src/onset/peakpick.h
@@ -40,11 +40,9 @@
 /** peak-picker creation function */
 aubio_pickpeak_t * new_aubio_peakpicker(smpl_t threshold);
 /** real time peak picking function */
-smpl_t aubio_peakpick_pimrt(fvec_t * DF, aubio_pickpeak_t * p);
-/** function added by Miguel Ramirez to return the onset detection amplitude in peakval */
-uint_t aubio_peakpick_pimrt_wt( fvec_t* DF, aubio_pickpeak_t* p, smpl_t* peakval );
+smpl_t aubio_peakpicker_do(aubio_pickpeak_t * p, fvec_t * DF);
 /** get current peak value */
-smpl_t aubio_peakpick_pimrt_getval(aubio_pickpeak_t * p);
+smpl_t aubio_peakpicker_get_thresholded_input(aubio_pickpeak_t * p);
 /** destroy peak picker structure */
 void del_aubio_peakpicker(aubio_pickpeak_t * p);
 
--- a/src/tempo/tempo.c
+++ b/src/tempo/tempo.c
@@ -68,8 +68,9 @@
     o->blockpos = -1;
   }
   o->blockpos++;
-  tempo->data[0][1] = aubio_peakpick_pimrt_wt(o->of,o->pp,
-    &(o->dfframe->data[0][winlen - step + o->blockpos]));
+  tempo->data[0][1] = aubio_peakpicker_do (o->pp, o->of);
+  o->dfframe->data[0][winlen - step + o->blockpos] = 
+    aubio_peakpicker_get_thresholded_input(o->pp);
   /* end of second level loop */
   tempo->data[0][0] = 0; /* reset tactus */
   i=0;