changeset 10:2ab6f4670cf5

added in the best estimate of error between the observed midi note and the aligned midi track.
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Mon, 17 Oct 2011 22:22:55 +0100
parents 75dcd1308658
children df9c838d0b8f
files .DS_Store src/midiEventHolder.cpp src/midiEventHolder.h workingNotes.rtf
diffstat 4 files changed, 28 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
Binary file .DS_Store has changed
--- a/src/midiEventHolder.cpp	Tue Aug 23 11:20:44 2011 +0100
+++ b/src/midiEventHolder.cpp	Mon Oct 17 22:22:55 2011 +0100
@@ -181,6 +181,7 @@
 	
 	timeString += " \n :  new offset " + ofToString(bayesStruct.prior.offset , 0);
 	timeString += " \n best estimate "+ofToString(bayesStruct.bestEstimate, 1);
+	timeString += " error "+ofToString(minimumMatchError, 0);
 	timeString += " map "+ofToString(bayesStruct.relativeSpeedPosterior.integratedEstimate, 1);
 	timeString += " rel speed "+ofToString(bayesStruct.relativeSpeedPosterior.getIndexInRealTerms(bayesStruct.relativeSpeedPosterior.integratedEstimate), 1);
 	
@@ -259,7 +260,7 @@
 
 	matchesFound.clear();
 	int startIndex = 0;
-	
+
 	if (recordedEventTimes.size() > 0){
 	
 		//get to the right range of events to check in
@@ -270,6 +271,7 @@
 
 	IntVector v;
 	DoubleVector d;
+	double tmpError = 100000.;//v high error
 	
 	double minimumConfidence = 0;
 	while (startIndex < recordedEventTimes.size() && recordedEventTimes[startIndex] < endTime){
@@ -287,6 +289,13 @@
 			double confidence = eventConfidence;//bayesStruct.posterior.getValueAtMillis(mouseX);
 	//																   recordedEventTimes[startIndex]);
 			matchString += "["+ofToString(startIndex)+"] = "+ofToString(confidence, 3)+" .";
+			
+			if (abs(recordedEventTimes[startIndex] - bayesStruct.bestEstimate) < tmpError){
+				//record the error between expected and observed times
+				tmpError = abs(recordedEventTimes[startIndex] - bayesStruct.bestEstimate);
+				minimumMatchError = recordedEventTimes[startIndex] - bayesStruct.bestEstimate;
+			}
+			
 		}
 		startIndex++;
 	}
--- a/src/midiEventHolder.h	Tue Aug 23 11:20:44 2011 +0100
+++ b/src/midiEventHolder.h	Mon Oct 17 22:22:55 2011 +0100
@@ -123,5 +123,6 @@
 	
 	bool confidenceWeightingUsed;
 	
+	double minimumMatchError;//recent best error between observed note and aligned midi file
 };
 #endif
\ No newline at end of file
--- a/workingNotes.rtf	Tue Aug 23 11:20:44 2011 +0100
+++ b/workingNotes.rtf	Mon Oct 17 22:22:55 2011 +0100
@@ -1,6 +1,6 @@
 {\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf350
-{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
-{\colortbl;\red255\green255\blue255;}
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fnil\fcharset0 Menlo-Regular;}
+{\colortbl;\red255\green255\blue255;\red0\green116\blue0;}
 \paperw11900\paperh16840\margl1440\margr1440\vieww20940\viewh15820\viewkind0
 \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\ql\qnatural\pardirnatural
 
@@ -30,4 +30,18 @@
 \
 decay speed distribution - so we have uncertainty about tempo\
 \
-cross update - so we have new prior for position}
\ No newline at end of file
+cross update - so we have new prior for position\
+\
+\
+//\
+working well - 18/8/11\
+\
+need to look at :\
+could weight the speed updates on the basis of how successful the location id was for the two notes. That way when we are on a roll we increase our ability to stay there.\
+\
+matches stored like this:
+\f1\fs28 \CocoaLigature0 \
+\pard\tx640\pardeftab640\ql\qnatural\pardirnatural
+\cf0 	\cf2 //size, index of match0, index of match1, ....
+\f0\fs24 \cf0 \CocoaLigature1 \
+}
\ No newline at end of file