# HG changeset patch # User Andrew N Robertson # Date 1330098669 0 # Node ID 1ea18717ba7c3a57f6df2784b2bb8b9ae2cc6d41 # Parent 6565c7cb9c7185a3bde39eefe29636538df55b33 Adding in evaluation program for the tests - has the ouput of five trackers plus the input times in ms diff -r 6565c7cb9c71 -r 1ea18717ba7c SMCevaluation/BayesianDrumResultsTester.zip Binary file SMCevaluation/BayesianDrumResultsTester.zip has changed diff -r 6565c7cb9c71 -r 1ea18717ba7c newOFsrc/BayesDrumTracker.cpp --- a/newOFsrc/BayesDrumTracker.cpp Wed Feb 22 22:29:43 2012 +0000 +++ b/newOFsrc/BayesDrumTracker.cpp Fri Feb 24 15:51:09 2012 +0000 @@ -99,6 +99,8 @@ void BayesDrumTracker::setBeatDistribution(int beatPosition){ switch (beatPosition){ + //beat position is in twelfth divisions of a 'beat' so position 6 is an eighth note out etc + //early sixteenth is that the beat is a sixteenth earlier case 0: case 1: diff -r 6565c7cb9c71 -r 1ea18717ba7c newOFsrc/bayesianArray.cpp --- a/newOFsrc/bayesianArray.cpp Wed Feb 22 22:29:43 2012 +0000 +++ b/newOFsrc/bayesianArray.cpp Fri Feb 24 15:51:09 2012 +0000 @@ -60,6 +60,7 @@ if (mean >= 0 && mean <= ARRAY_SIZE){ int i; float eighthDifference; + //main beat position plus these three: int eighthPosition = ((int)mean + ARRAY_SIZE/2)%ARRAY_SIZE; int earlySixteenthPosition = ((int)mean + (3*ARRAY_SIZE/4))%ARRAY_SIZE;; int lateSixteenthPosition = ((int)mean + (ARRAY_SIZE/4))%ARRAY_SIZE;; @@ -313,6 +314,7 @@ double bayesianArray::getEntropyOfPosterior(){ double entropy = 0; + //make sure normalised? (it is) for (int i = 0;i < ARRAY_SIZE;i++){ if (posterior[i] > 0){ entropy += posterior[i]*log(posterior[i]); diff -r 6565c7cb9c71 -r 1ea18717ba7c newOFsrc/testApp.cpp --- a/newOFsrc/testApp.cpp Wed Feb 22 22:29:43 2012 +0000 +++ b/newOFsrc/testApp.cpp Fri Feb 24 15:51:09 2012 +0000 @@ -171,7 +171,9 @@ drumTracker.newKickError(m.getArgAsFloat(0), m.getArgAsFloat(2), m.getArgAsString(1)); KLdiv = drumTracker.beatDistribution.getKLdivergence(); entropy = drumTracker.beatDistribution.getEntropyOfPosterior(); - }//end if new error + recentError = m.getArgAsFloat(0); + drumType = m.getArgAsString(1); + }//end if new error @@ -385,6 +387,14 @@ ofDrawBitmapString("Entropy :"+ofToString(entropy, 3), 20, 60); double entropyDrawFactor = 0.1; ofRect(60, ofGetHeight()*(1-entropy*entropyDrawFactor), 40, ofGetHeight()*entropy*entropyDrawFactor); + + ofSetColor(100,0,200, 220); + ofDrawBitmapString("Error :"+ofToString(recentError, 3), 20, 80); + ofRect(120, ofGetHeight()*(1-fabs(recentError)), 40, ofGetHeight()*2*fabs(recentError)); + + ofSetColor(100,0,100, 220); + ofDrawBitmapString(drumType, 20, 0); + } diff -r 6565c7cb9c71 -r 1ea18717ba7c newOFsrc/testApp.h --- a/newOFsrc/testApp.h Wed Feb 22 22:29:43 2012 +0000 +++ b/newOFsrc/testApp.h Fri Feb 24 15:51:09 2012 +0000 @@ -122,7 +122,8 @@ // string tempoUpdateStrings[16]; // string tempoDataString; - double KLdiv, entropy; + double KLdiv, entropy, recentError; + string drumType; void drawKLdivAndEntropy(); private: