changeset 6:6a95d8b80393 tip

unknown changes
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Mon, 26 Nov 2012 23:17:34 +0000
parents eba88b84b5ca
children
files Source/aubioOnsetDetect~.cpp external Frameworks/aubioFullOSXUni/.DS_Store external Frameworks/aubioFullOSXUni/include/.DS_Store
diffstat 3 files changed, 40 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/Source/aubioOnsetDetect~.cpp	Mon Oct 22 20:25:14 2012 +0100
+++ b/Source/aubioOnsetDetect~.cpp	Mon Nov 26 23:17:34 2012 +0000
@@ -32,7 +32,7 @@
 	void						*rawDetectionFunctionOutlet;	
 	void						*medianDetectionFunctionOutlet;	
 	
-	bool						useMedianOnsetDetection;//(true) 
+//	bool						useMedianOnsetDetection;//(true) 
 								//rather than Paul B's peak picking (false)
 
 } t_aubioOnsetDetect;
@@ -106,6 +106,7 @@
 	
 	//set this up in AubioOnsetDetector class instead
 	//x->onsetDetector = new AubioOnsetDetector();
+	
 	x->onsetDetector->buffersize = x->bufsize;
 	x->onsetDetector->hopsize = x->hopsize;
 //	x->onsetDetector->threshold = x->threshold;
@@ -249,7 +250,16 @@
 	// aubio onset detector then processes current frame - returns bool true when new detection is output
 	if (x->onsetDetector->processframe(frame, n)){
 	//if buffer full and new result is processed (buffer is 1024 with hopsize 512 - can be set to other values)
-		outlet_float(x->medianDetectionFunctionOutlet, x->onsetDetector->bestSlopeMedian);//medianDetectionValue
+
+		outlet_float(x->medianDetectionFunctionOutlet,  x->onsetDetector->bestSlopeMedian);
+		/*
+		//idea for getting processed value out
+		 if (x->onsetDetector->rawDetectionValue > x->onsetDetector->medianDetectionValue)
+			outlet_float(x->medianDetectionFunctionOutlet, x->onsetDetector->rawDetectionValue - x->onsetDetector->medianDetectionValue);
+		else 
+			outlet_float(x->medianDetectionFunctionOutlet, 0.0);
+		 */
+		
 		outlet_float(x->rawDetectionFunctionOutlet, x->onsetDetector->rawDetectionValue);
 	//	outlet_float(x->detectionFunctionOutlet, x->onsetDetector->peakPickedDetectionValue);
 		outlet_float(x->detectionFunctionOutlet, x->onsetDetector->bestSlopeValue);
@@ -326,7 +336,11 @@
 	if (x = (t_aubioOnsetDetect *)object_alloc((t_class *) aubioOnsetDetect_class)) {
 		dsp_setup((t_pxobject *)x, 1);	// MSP inlets: arg is # of inlets and is REQUIRED! 
 										// use 0 if you don't need inlets
-
+		
+		
+		object_post((t_object*)x, (char*) "Aubio Onset Detect Revamp found, created by Andrew Robertson from work by Paul Brossier, Queen Mary University");
+		
+		
 		//set outlets, from right to left
 		x->medianDetectionFunctionOutlet = floatout(x);
 		x->medianBangOutlet  = bangout(x);
@@ -334,32 +348,24 @@
 		x->detectionFunctionOutlet = floatout(x);
 		x->bangoutlet  = bangout(x);
 
+//		outlet_new(x, "signal"); - no longer
+		
 		//aubio params
 		x->threshold = 1;
 		x->threshold2 = -70.;
 		
-		if (argc > 1){
-			t_atom my_atom = argv[1];
-			aubioOnsetDetect_setBuffersize(x, atom_getlong(&my_atom));
-			object_post((t_object*)x, (char*) "Buffersize set by user to %i ", atom_getfloat(&my_atom));
-		}else{
-			x->bufsize   = 1024;//using fixed buffer size here.
-			x->hopsize   = x->bufsize / 2;
-			
-			//set this up in AubioOnsetDetector class instead
-			x->onsetDetector = new AubioOnsetDetector();
-			x->onsetDetector->buffersize = x->bufsize;
-			x->onsetDetector->hopsize = x->hopsize;
-			x->onsetDetector->threshold = x->threshold;
-			x->onsetDetector->threshold2 = x->threshold2;
-			x->onsetDetector->initialise();
-		}
+		//set this up in AubioOnsetDetector class instead
+		x->onsetDetector = new AubioOnsetDetector();
+//		x->onsetDetector->buffersize = x->bufsize;
+//		x->onsetDetector->hopsize = x->hopsize;
+		x->onsetDetector->threshold = x->threshold;
+		x->onsetDetector->threshold2 = x->threshold2;
 		
+	
 						
-		if (argc > 0){//i.e. there is an argument on creation like [aubioOnsetDetect~ 0.3]
+		if (argc > 0 && argv->a_type == A_FLOAT){//i.e. there is an argument on creation like [aubioOnsetDetect~ 0.3]
 			t_atom my_atom = argv[0];
-			object_post((t_object*)x, (char*) "Aubio Onset Detect found, created by Andrew Robertson from work by Paul Brossier, Queen Mary University");
-			object_post((t_object*)x, (char*) "Threshold set to %f ", atom_getfloat(&my_atom));
+			object_post((t_object*)x, (char*) "Threshold argument: set to %f ", atom_getfloat(&my_atom));
 			x->threshold = atom_getfloat(&my_atom);
 		
 			if (x->threshold > 10)
@@ -371,7 +377,18 @@
 			x->onsetDetector->threshold = x->threshold;
 		}
 		
-		x->useMedianOnsetDetection = true;
+		if (argc > 1 && (argv+1)->a_type == A_LONG){
+			t_atom my_atom = argv[1];
+			aubioOnsetDetect_setBuffersize(x, atom_getlong(&my_atom));
+			object_post((t_object*)x, (char*) "Buffersize argument: set to %ld ", atom_getlong(&my_atom));
+		} else {
+			x->bufsize   = 1024;//using fixed buffer size here.
+			x->hopsize   = x->bufsize / 2;
+		}
+		
+		x->onsetDetector->initialise();
+		
+	//	x->useMedianOnsetDetection = true;
 	}
 	return (x);
 }
Binary file external Frameworks/aubioFullOSXUni/.DS_Store has changed
Binary file external Frameworks/aubioFullOSXUni/include/.DS_Store has changed