changeset 48:5359e2c0b0fb

Added data from six tracks. Absolute histogram
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Wed, 09 May 2012 21:55:16 +0100
parents 689704aa55d5
children 8df911733fdc
files annotationCalculatorSrc/BeatAnnotationReader.cpp annotationCalculatorSrc/Histogram.cpp annotationCalculatorSrc/Histogram.h annotationCalculatorSrc/PlotTools.cpp annotationCalculatorSrc/testApp.cpp annotationCalculatorSrc/testApp.h src/AudioEventMatcher.cpp src/RecordedMultitrackAudio.cpp
diffstat 8 files changed, 120 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/annotationCalculatorSrc/BeatAnnotationReader.cpp	Wed May 09 12:38:00 2012 +0100
+++ b/annotationCalculatorSrc/BeatAnnotationReader.cpp	Wed May 09 21:55:16 2012 +0100
@@ -16,7 +16,7 @@
 	// "/Users/andrew/Documents/work/MuseScore/RWC/ANNOTATION/RM-C002_annotation+WavPos.csv"
 	beatTimes.clear();
 	
-	//	printf("MATCH : READ FILE %s\n", pathName.c_str());
+		printf("READ FILE %s\n", pathName.c_str());
 	ifstream file ( pathName.c_str());
 	string value, tmpLine;
 	stringstream iss;
@@ -50,7 +50,7 @@
 	}//end while
 	
 	//	printBeatTimes();
-	//	printf("There are %i MATCH annotations\n", (int)matchData.size());
+		printf("There are %i BEAT annotations\n", (int)beatTimes.size());
 	
 }
 
--- a/annotationCalculatorSrc/Histogram.cpp	Wed May 09 12:38:00 2012 +0100
+++ b/annotationCalculatorSrc/Histogram.cpp	Wed May 09 21:55:16 2012 +0100
@@ -14,6 +14,7 @@
 }
 
 void Histogram::createHistogram(const int& binWidthIn, const int& numberofBinsIn){
+	//printf("create regular histo\n");
 	numberofBins = numberofBinsIn;
 	binWidth = binWidthIn;
 	minimumBinValue = -1.0 * binWidth * ((double)numberofBins/2);
@@ -26,6 +27,23 @@
 	
 }
 
+
+void Histogram::createAbsoluteHistogram(const int& binWidthIn, const int& numberofBinsIn){
+	printf("create abs histo\n");
+	
+	minimumBinValue = 0;
+	numberofBins = numberofBinsIn;
+	binWidth = binWidthIn;
+	
+	histogram.clear();
+	histogram.assign(numberofBins, 0);
+	
+	maximum = 0;
+	numberOutsideRange = 0;
+	
+	setBinPoints();
+}
+
 void Histogram::setBinPoints(){
 	binPoints.clear();
 	binPoints.push_back(minimumBinValue);
@@ -34,9 +52,9 @@
 	}
 	maximumBinValue = binPoints[binPoints.size()-1]+binWidth;
 	
-	for (int k = 0; k < binPoints.size();k++){
-		printf("Bin pts [%i] : %f\n", k, binPoints[k]);
-	}
+//	for (int k = 0; k < binPoints.size();k++){
+//		printf("Bin pts [%i] : %f\n", k, binPoints[k]);
+//	}
 	
 }
 
@@ -51,16 +69,18 @@
 		//5 bins, width is 10
 		//then we start around zero for the 5+1/2 th, i.e. 3rd bin
 		//zero is the 5/2 th pt
+	//	printf("data[%i] %f\n", i, data[i]);
 		
 		bin = 0;
 		binPoint = binPoints[0];//i.e. minimumBinValue;
-		
+	//	printf("binpT%f\n", binPoint);
 		if (data[i] >= binPoint){//i.e. falls inside
 		//	while (data[i] > (binPoint + binWidth) && bin < numberofBins) {
-			while (bin < numberofBins && data[i] > binPoints[bin+1]) {
+			while (bin < numberofBins && data[i] > binPoints[bin]) {
 				//printf("data pt %f bin %i binPt %.1f\n", data[i], bin, binPoint);
 				bin++;
 				binPoint = binPoints[bin];
+				
 //				binPoint += binWidth;
 //				bin++;				
 			}
@@ -84,7 +104,7 @@
 		if (histogram[k] > maximum)
 			maximum = histogram[k];
 		
-		printf("HISTO[%i] = %i\n", k, histogram[k]);
+		printf("HISTO[%i] (%.1f - %.1f) = %i\n", k, binPoints[k], binPoints[k]+binWidth, histogram[k]);
 	}
 	printf("Number outside %i\n", numberOutsideRange);
 	
--- a/annotationCalculatorSrc/Histogram.h	Wed May 09 12:38:00 2012 +0100
+++ b/annotationCalculatorSrc/Histogram.h	Wed May 09 21:55:16 2012 +0100
@@ -21,7 +21,10 @@
 	typedef std::vector<int> IntVector;
 	IntVector histogram;
 	
-	void createHistogram(const int& binWidth, const int& numberofBins);
+	void createHistogram(const int& binWidthIn, const int& numberofBinsIn);
+	void createAbsoluteHistogram(const int& binWidthIn, const int& numberofBinsIn);
+	
+	
 	void processDataIntoHistogram(const DoubleVector& data);
 	void plotHistogram();
 	void plotHistogram(const double& maxHeight);
--- a/annotationCalculatorSrc/PlotTools.cpp	Wed May 09 12:38:00 2012 +0100
+++ b/annotationCalculatorSrc/PlotTools.cpp	Wed May 09 21:55:16 2012 +0100
@@ -7,6 +7,9 @@
  *
  */
 
+//To DO
+//need to fix axes
+
 #include "PlotTools.h"
 
 PlotTools::PlotTools(){
@@ -117,7 +120,7 @@
 			
 			int markIndex = round(screenWidth * x/numberOfPts);
 			ofLine(markIndex, screenHeight, markIndex, screenHeight-10);
-			ofDrawBitmapString(ofToString(d[wIndex], 1), markIndex, screenHeight - 20);
+			ofDrawBitmapString(ofToString(d[wIndex]*1000.0, 0), markIndex, screenHeight - 20);
 		}//end for x for axis
 		
 		
@@ -130,7 +133,7 @@
 			
 			int markIndex = getY(round(screenHeight * y/numberOfPts));
 			ofLine(0, markIndex, 10, markIndex);
-			ofDrawBitmapString(ofToString(h[hIndex], 1), 2, markIndex);
+			ofDrawBitmapString(ofToString(h[hIndex]*1000.0, 0), 2, markIndex);
 		}//end for y for axis
 	}//end draw axes
 		
--- a/annotationCalculatorSrc/testApp.cpp	Wed May 09 12:38:00 2012 +0100
+++ b/annotationCalculatorSrc/testApp.cpp	Wed May 09 21:55:16 2012 +0100
@@ -6,9 +6,16 @@
 	histogramWidth = 10;
 	histogramBinNumber = 25;
 
-	setFilePaths(1);
-	readInFiles();
-	processResults();
+	
+	
+	multiAbsTotalHistogram.createAbsoluteHistogram(histogramWidth, histogramBinNumber);
+	matchBackwardsAbsTotalHistogram.createAbsoluteHistogram(histogramWidth, histogramBinNumber);
+	matchForwardAbsTotalHistogram.createAbsoluteHistogram(histogramWidth, histogramBinNumber);
+	//processFile(0);
+	
+	for (int i = 0;i < 1;i++){
+		processFile(i);
+	}
 	
 	screenToDraw = 1;
 
@@ -20,15 +27,21 @@
 }
 
 
+void testApp::processFile(int file){
+	setFilePaths(file);
+	readInFiles();
+	processResults();
+}
+
 void testApp::setFilePaths(int fileToLoad){
 	
 	switch (fileToLoad) {
 		case 0:
-			liveGroundTruthPath = "../../../data/marbleArch_4_beats.txt";
-			rehearsalGroundTruthPath = "../../../data/marbleArch_6_beats.txt";
-			liveToRehMultitrackAlignmentPath = "../../../data/MarbleArch_live4_reh6_newOutput.txt";
-			liveToRehMatchOFpath = "../../../data/MatchAlignments/marbleArchlive4_reh6_match_OF.out";
-			liveToRehMatchOBpath = "../../../data/MatchAlignments/marbleArchlive4_reh6_match_OB.out";
+			liveGroundTruthPath = "../../../data/MarbleArch/marbleArch_4_beats.txt";
+			rehearsalGroundTruthPath = "../../../data/MarbleArch/marbleArch_6_beats.txt";
+			liveToRehMultitrackAlignmentPath = "../../../data/MarbleArch/MarbleArch_live4_reh6_newOutput.txt";
+			liveToRehMatchOFpath = "../../../data/MarbleArch/marbleArchlive4_reh6_match_OF.out";
+			liveToRehMatchOBpath = "../../../data/MarbleArch/marbleArchlive4_reh6_match_OB.out";
 			break;
 		case 1:
 			liveGroundTruthPath = "../../../data/Lewes/LewesTake14_beatsSV.txt";
@@ -37,6 +50,45 @@
 			liveToRehMatchOFpath = "../../../data/Lewes/LewesLive14_reh13p_match_OF.out";
 			liveToRehMatchOBpath = "../../../data/Lewes/LewesLive14_reh13p_match_OB.out";
 			break;
+		case 2:
+			liveGroundTruthPath = "../../../data/Wanderlust/wanderlust_take15_svBeats.txt";
+			rehearsalGroundTruthPath = "../../../data/Wanderlust/wanderlust_take16_svBeats.txt";
+	//		liveToRehMultitrackAlignmentPath = "../../../data/Wanderlust/wanderlust_live15_reh16_output.txt";
+	//		liveToRehMultitrackAlignmentPath = "../../../data/Wanderlust/wanderlust_live15_reh16_2_output.txt";
+			liveToRehMultitrackAlignmentPath = "../../../data/Wanderlust/wandelust_live15_reh16_3_output_4msonsetw_dot2like.txt";
+			liveToRehMatchOFpath = "../../../data/Wanderlust/wanderlustLive15_reh16_match_OF.out";
+			liveToRehMatchOBpath = "../../../data/Wanderlust/wanderlustLive15_reh16_match_OB.out";
+			break;	
+		
+		case 3:
+			//THESE NEED FIXING OF GROUTND TRUTH BEATS
+			liveGroundTruthPath = "../../../data/DiamondWhite/DiamondWhite_Take1_beats.txt";
+			rehearsalGroundTruthPath = "../../../data/DiamondWhite/DiamondWhite_Take2_beats.txt";
+			liveToRehMultitrackAlignmentPath = "../../../data/DiamondWhite/DiamondWhite_live1_reh2_new_output.txt";
+			liveToRehMatchOFpath = "../../../data/DiamondWhite/DiamondWhite_live1_reh2_match_OF.out";
+			liveToRehMatchOBpath = "../../../data/DiamondWhite/DiamondWhite_live1_reh2_match_OB.out";
+			break;	
+			
+		case 4:
+			//THESE NEED FIXING OF GROUTND TRUTH BEATS
+			liveGroundTruthPath = "../../../data/Motorcade/Motorcade_take53_beats.txt";
+			rehearsalGroundTruthPath = "../../../data/Motorcade/Motorcade_take57_beats.txt";
+			liveToRehMultitrackAlignmentPath = "../../../data/Motorcade/motorcade_live53_reh57_output.txt";
+			liveToRehMatchOFpath = "../../../data/Motorcade/Motorcade_live53_reh57_match_OF.out";
+			liveToRehMatchOBpath = "../../../data/Motorcade/Motorcade_live53_reh57_match_OB.out";
+			break;	
+	
+		
+			
+		case 5:
+			//THESE NEED FIXING OF GROUTND TRUTH BEATS
+			liveGroundTruthPath = "../../../data/SonOfMan/SonOfMan_take2_svBeats.txt";
+			rehearsalGroundTruthPath = "../../../data/SonOfMan/SonOfMan_take3_svBeats.txt";
+			liveToRehMultitrackAlignmentPath = "../../../data/SonOfMan/SonOfMan_live2_reh3_thinner_output.txt";
+			liveToRehMatchOFpath = "../../../data/SonOfMan/SonOfMan_live2_reh3_match_OF.out";
+			liveToRehMatchOBpath = "../../../data/SonOfMan/SonOfMan_live2_reh3_match_OB.out";
+			break;	
+		
 			
 		default:
 			/*liveGroundTruthPath = NULL;
@@ -83,16 +135,22 @@
 	beatReader.calculateMedianError(GroundTruth[0], GroundTruth[1], beatReader.alignmentTimes[0], beatReader.alignmentTimes[1]);
 	multiHistogram.createHistogram(histogramWidth, histogramBinNumber);
 	multiHistogram.processDataIntoHistogram(beatReader.errors);
+		printf("\nMULTI ABS\n");
+	multiAbsTotalHistogram.processDataIntoHistogram(beatReader.absoluteErrors);
 	
 	printf("\n\nMATCH BACKWARDS\n");
 	beatReader.calculateMedianError(GroundTruth[0], GroundTruth[1], matchBackwardsNotations.matchLiveTimes, matchBackwardsNotations.matchRehearsalTimes);
 	matchBackwardsHistogram.createHistogram(histogramWidth, histogramBinNumber);
 	matchBackwardsHistogram.processDataIntoHistogram(beatReader.errors);
+		printf("\nMATCH OB ABS\n");
+	matchBackwardsAbsTotalHistogram.processDataIntoHistogram(beatReader.absoluteErrors);
 	
 	printf("\n\nMATCH FORWARDS\n");
 	beatReader.calculateMedianError(GroundTruth[0], GroundTruth[1], matchForwardNotations.matchLiveTimes, matchForwardNotations.matchRehearsalTimes);
 	matchForwardHistogram.createHistogram(histogramWidth, histogramBinNumber);										  
 	matchForwardHistogram.processDataIntoHistogram(beatReader.errors);
+	printf("\nMATCH OF ABS\n");
+	matchForwardAbsTotalHistogram.processDataIntoHistogram(beatReader.absoluteErrors);
 	
 }
 
@@ -230,7 +288,7 @@
 	yPlotMax = beatReader.alignmentTimes[1][index];
 	
 	
-	printPlotValues();
+	//printPlotValues();
 }
 
 void testApp::printPlotValues(){
--- a/annotationCalculatorSrc/testApp.h	Wed May 09 12:38:00 2012 +0100
+++ b/annotationCalculatorSrc/testApp.h	Wed May 09 21:55:16 2012 +0100
@@ -30,6 +30,8 @@
 	
 	BeatAnnotationReader beatReader;
 	
+	void processFile(int file);
+	
 	void setFilePaths(int fileToLoad);
 	void readInFiles();
 	void processResults();
@@ -50,6 +52,10 @@
 	Histogram matchBackwardsHistogram;
 	Histogram matchForwardHistogram;
 	
+	Histogram multiAbsTotalHistogram;
+	Histogram matchBackwardsAbsTotalHistogram;
+	Histogram matchForwardAbsTotalHistogram;
+	
 	int screenToDraw;
 	int histogramWidth, histogramBinNumber;
 	
--- a/src/AudioEventMatcher.cpp	Wed May 09 12:38:00 2012 +0100
+++ b/src/AudioEventMatcher.cpp	Wed May 09 21:55:16 2012 +0100
@@ -24,8 +24,8 @@
 	chromaLikelihoodToNoise = 0.5;//lower => more noise, higher more weight for events
 	chromaLikelihoodWidth = 50;//ms round onset event
 	
-	onsetLikelihoodToNoise = 0.1;
-	onsetLikelihoodWidth = 10;//in ms
+	onsetLikelihoodToNoise = 0.2;//0.1 and 10 as to 9/5/12
+	onsetLikelihoodWidth = 6;//in ms
 	
 	setArraySizes();
 	
--- a/src/RecordedMultitrackAudio.cpp	Wed May 09 12:38:00 2012 +0100
+++ b/src/RecordedMultitrackAudio.cpp	Wed May 09 21:55:16 2012 +0100
@@ -16,7 +16,7 @@
 
 	printf("loaded max val  is %f\n", loadedAudioFiles[0].fileLoader.onsetDetect.onsetDetector.maximumDetectionValue);
 	
-	int multitrackToLoad = 19;
+	int multitrackToLoad = 18;
 	setDifferentMultitracks(multitrackToLoad);//command to load this set of audio files - see below
 	
 	//number 7 is problematic with memory
@@ -192,6 +192,13 @@
 			guitarfilename = "/Users/andrew/Music/Logic/SonOfMan/SonOfManMultitracks/SonOfMan_TakeThree/Electric di_bip.wav";
 			break;
 			
+		case 23:
+			bassfilename = "/Volumes/Supersaurus/TractorsAlbum/TractorsMotorcade/Motorcade/Bounces/MotorcadeMulittracks/Motorcade_Take_57/bass DI_bip.wav";
+			kickfilename = "/Volumes/Supersaurus/TractorsAlbum/TractorsMotorcade/Motorcade/Bounces/MotorcadeMulittracks/Motorcade_Take_57/Kick re20_bip.wav";
+			snarefilename = "/Volumes/Supersaurus/TractorsAlbum/TractorsMotorcade/Motorcade/Bounces/MotorcadeMulittracks/Motorcade_Take_57/Snare sm578_bip.wav";
+			guitarfilename = "/Volumes/Supersaurus/TractorsAlbum/TractorsMotorcade/Motorcade/Bounces/MotorcadeMulittracks/Motorcade_Take_57/guitar DI_bip.wav";
+			break;
+			
 			
 			
 	}