changeset 32:f91b7b019350

test example for writing text
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Mon, 12 Dec 2011 09:43:37 +0000
parents 9a70d9abdc8b
children fa527df85c2c
files .DS_Store hackday/midiEventHolder.cpp hackday/testApp.cpp
diffstat 3 files changed, 33 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
Binary file .DS_Store has changed
--- a/hackday/midiEventHolder.cpp	Sun Dec 11 17:19:34 2011 +0000
+++ b/hackday/midiEventHolder.cpp	Mon Dec 12 09:43:37 2011 +0000
@@ -23,6 +23,16 @@
 	interNoteRange = 1600;//preferred duration
 	//so max here is really four
 	
+	
+	likelihoodWidth = 100;//using 100 is good
+	likelihoodToNoiseRatio = 0.20;//was 0.02 on 18/11/11, changing to give more weight to observations
+									//was 0.08 on 11/12/11 but need more for tempo varn in rwc database
+	
+	bayesStruct.speedLikelihoodNoise = 0.1;//was 0.05
+	bayesStruct.speedDecayWidth = 40;
+	bayesStruct.speedDecayAmount = 10;
+	
+	
 	//there is option to use MAP estinate or integral in beayesianarraystricture class
 	
 	runningInRealTime = true;
@@ -46,13 +56,6 @@
 
 
 
-	likelihoodWidth = 100;//using 100 is good
-	likelihoodToNoiseRatio = 0.08;//was 0.02 on 18/11/11, changing to give more weight to observations
-	
-	bayesStruct.speedLikelihoodNoise = 0.1;//was 0.05
-	bayesStruct.speedDecayWidth = 40;
-	bayesStruct.speedDecayAmount = 10;
-	
 
 	
 	speedPriorValue = 1.0;
--- a/hackday/testApp.cpp	Sun Dec 11 17:19:34 2011 +0000
+++ b/hackday/testApp.cpp	Mon Dec 12 09:43:37 2011 +0000
@@ -157,6 +157,29 @@
 				midiEvents.minimumMatchSpeed = minSpeed;
 			}
 		}
+
+		if ( m.getAddress() == "/maximumSpeedRatio" )
+		{
+			
+			float maxSpeed = m.getArgAsFloat(0);
+			//printf("minimum speed received is  %f and max is %f\n", minSpeed, midiEvents.bayesStruct.relativeSpeedLikelihood.getIndexInRealTerms(midiEvents.bayesStruct.relativeSpeedLikelihood.length-1));
+			if (maxSpeed > midiEvents.minimumMatchSpeed && maxSpeed <= midiEvents.bayesStruct.relativeSpeedLikelihood.getIndexInRealTerms(midiEvents.bayesStruct.relativeSpeedLikelihood.length-1)){
+				printf("maximum speed accepted is %f\n", maxSpeed);
+				midiEvents.maximumMatchSpeed = maxSpeed;
+			}
+		}
+		
+		if ( m.getAddress() == "/likelihoodToNoiseRatio" )
+		{
+			
+			float ratio = m.getArgAsFloat(0);
+			
+			if (ratio > 0.001 && ratio < 0.6){
+				midiEvents.likelihoodToNoiseRatio = ratio;
+				printf("likelihood for events relative to noise uses ratio %f\n", ratio);
+			}
+		
+		}
 		
 	}//end while osc
 	if (midiEvents.recordedEventTimes.size() > 0)