Mercurial > hg > bayesian-drum-tracker
changeset 4:1ea18717ba7c
Adding in evaluation program for the tests - has the ouput of five trackers plus the input times in ms
author | Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk> |
---|---|
date | Fri, 24 Feb 2012 15:51:09 +0000 |
parents | 6565c7cb9c71 |
children | 4288150c257b |
files | SMCevaluation/BayesianDrumResultsTester.zip newOFsrc/BayesDrumTracker.cpp newOFsrc/bayesianArray.cpp newOFsrc/testApp.cpp newOFsrc/testApp.h |
diffstat | 5 files changed, 17 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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:
--- 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]);
--- 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); + }
--- 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: