changeset 39:f5de07b4d733

helped the tempo prior to have wider shape
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Tue, 24 Apr 2012 23:57:10 +0100
parents 9c803369b229
children 0d66ecd1f4d3
files bayesianArraySrc/BayesianArrayStructure.cpp bayesianArraySrc/BayesianArrayStructure.h src/AccompanimentSynchroniser.h src/AudioEventMatcher.cpp src/RecordedMultitrackAudio.cpp src/testApp.cpp
diffstat 6 files changed, 50 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/bayesianArraySrc/BayesianArrayStructure.cpp	Tue Apr 24 16:37:52 2012 +0100
+++ b/bayesianArraySrc/BayesianArrayStructure.cpp	Tue Apr 24 23:57:10 2012 +0100
@@ -31,7 +31,7 @@
 
 	tmpBestEstimate = 0;
 	crossUpdateTimeThreshold = 60;
-	priorWidth = 20;
+	priorWidth = 0.1;
 	
 
 	
@@ -108,8 +108,9 @@
 	relativeSpeedPosterior.zero();
 	
 	//changed these a bit - still need to figure tempo process out properly
-	relativeSpeedPosterior.addGaussianShape(index, priorWidth, 1.9);
-	relativeSpeedPosterior.addGaussianShape(relativeSpeedPosterior.getRealTermsAsIndex(1), 4, 1);
+	relativeSpeedPosterior.addGaussianShapeFromRealTime(1, priorWidth, 4);
+		
+	//relativeSpeedPosterior.addGaussianShape(relativeSpeedPosterior.getRealTermsAsIndex(1), 4, 1);
 	
 	printf("speed adding to index for 1 = %f\n", relativeSpeedPosterior.getRealTermsAsIndex(1));
 //	relativeSpeedPosterior.addToIndex(relativeSpeedPosterior.getRealTermsAsIndex(1), 0.5);
@@ -176,13 +177,15 @@
 	
 	updateCounter = 0;
 	
-	posterior.offset = -1000;
+	posterior.offset = -1 * startingWindowWidth / 2;//is set from the audioEventMatcher class
 	setNewDistributionOffsets(0);
 	
 	int zeroIndex = posterior.getRealTermsAsIndex(0);
 	printf("ZERO INDEX %i\n", zeroIndex);
+	int offset = posterior.getIndexInRealTerms(0);
+	printf("offset is %i\n", offset);
 	
-	posterior.addGaussianShapeFromRealTime(0, 50, 1);//one way to add at x msec
+	posterior.addGaussianShapeFromRealTime(0, 2000, 1);//one way to add at x msec
 //	posterior.addGaussianShape(posterior.getRealTermsAsIndex(10), 50, 1);//alternative way
 	
 	likelihood.addConstant(1);
@@ -192,7 +195,7 @@
 
 	printf("bayes reset arrays - best estimate %f\n", lastBestEstimateUpdateTime);
 	
-	setSpeedPrior(speedPriorValue);
+	setSpeedPrior(speedPriorValue);//setting the prior speed
 	relativeSpeedPosterior.copyFromDynamicVector(relativeSpeedPrior);
 	
 }
--- a/bayesianArraySrc/BayesianArrayStructure.h	Tue Apr 24 16:37:52 2012 +0100
+++ b/bayesianArraySrc/BayesianArrayStructure.h	Tue Apr 24 23:57:10 2012 +0100
@@ -103,6 +103,7 @@
 	void translatePosteriorByMaximumSpeed(DynamicVector& translatedPosterior, const double& timeDifferenceInPositionVectorUnits);
 	
 	void printPostOffset();
+	int startingWindowWidth;
 	bool updatingSpeedDistribution;//false for testing
 
 };
--- a/src/AccompanimentSynchroniser.h	Tue Apr 24 16:37:52 2012 +0100
+++ b/src/AccompanimentSynchroniser.h	Tue Apr 24 23:57:10 2012 +0100
@@ -43,10 +43,11 @@
 	double playingPositionTimeSent;
 	
 	double recordedPositionMillis;
+	double recordedPositionTimeSent;
 private:
 	
 	
-	double recordedPositionTimeSent;
+	
 	
 	double speed;
 	
--- a/src/AudioEventMatcher.cpp	Tue Apr 24 16:37:52 2012 +0100
+++ b/src/AudioEventMatcher.cpp	Tue Apr 24 23:57:10 2012 +0100
@@ -10,7 +10,8 @@
 #include "AudioEventMatcher.h"
 
 
-const int matchWindowWidth = 8000;
+const int matchWindowWidth = 8000;//ms in which to match
+
 const float pitchCutOff = 16;//within which pitches are even considered
 
 AudioEventMatcher::AudioEventMatcher(){
@@ -36,6 +37,8 @@
 	followingLiveInput = true;
 	startedPlaying = false;
 	recordedTempoIndex = 0;
+	
+	bayesianStruct.startingWindowWidth = matchWindowWidth / 4;
 //	temporal.setUpEventTimeMatrix();
 //	recordedTempoData.setUpEventTimeMatrix();
 }
@@ -156,9 +159,11 @@
 
 
 void AudioEventMatcher::setSpeedRatioDistribution(const double& speedRatio){
+	//here is the speed combo actually used
 	bayesianStruct.relativeSpeedPosterior.zero();
-	bayesianStruct.relativeSpeedPosterior.addToIndex(bayesianStruct.relativeSpeedPosterior.getRealTermsAsIndex(speedRatio), 1);
-	bayesianStruct.relativeSpeedPosterior.addGaussianShapeFromRealTime(1, 0.06, 0.8);
+//	bayesianStruct.relativeSpeedPosterior.addToIndex(bayesianStruct.relativeSpeedPosterior.getRealTermsAsIndex(speedRatio), 1);
+	bayesianStruct.relativeSpeedPosterior.addGaussianShapeFromRealTime(1, 0.1, 3);
+	bayesianStruct.relativeSpeedPosterior.addGaussianShapeFromRealTime(1, 0.02, 2);
 }
 
 void AudioEventMatcher::stopPlaying(){
@@ -234,8 +239,8 @@
 	
 	//draw some outlines in blue
 	ofSetColor(20,200,200);
-	bayesPositionWindow.drawOutline();
-	bayesTempoWindow.drawOutline();
+//	bayesPositionWindow.drawOutline();
+//	bayesTempoWindow.drawOutline();
 	
 	//draw the scrolling audio tracks
 	recordedTracks.drawTracks();
@@ -395,12 +400,12 @@
 	tmpStr +=  ", Time "+ofToString(recentPitchEventTime, 0);
 	ofDrawBitmapString(tmpStr, 20, 20);
 	
-	string alignString = " align "+ofToString(currentAlignmentPosition, 2);
+	string alignString = "align "+ofToString(currentAlignmentPosition, 2);//same as synchroniser-recordedposition
 	alignString += " playing "+ofToString(synchroniser.playingPositionRatio, 5);
-	alignString += "  pos "+ofToString(synchroniser.playingPositionMillis,0)+" ms";
-	alignString +=  "  rec pos "+ofToString(synchroniser.recordedPositionMillis,0)+" ms";
+	alignString += "  pos "+ofToString(synchroniser.playingPositionMillis,0)+" ms";//playing position in file - causal correction 
+	alignString +=  "  rec pos "+ofToString(synchroniser.recordedPositionMillis,0)+" ms";//currentAlignmentPosition in rehearsal
+	alignString += "playing time "+ofToString(synchroniser.recordedPositionTimeSent, 0)+" ms";//playing time since begining of live take
 	ofDrawBitmapString(alignString, 20, 50);
-	
 	ofDrawBitmapString("pos "+ofToString(recordedTracks.loadedAudioFiles[0].fileLoader.onsetDetect.playPosition), 200,600);
 	
 }
--- a/src/RecordedMultitrackAudio.cpp	Tue Apr 24 16:37:52 2012 +0100
+++ b/src/RecordedMultitrackAudio.cpp	Tue Apr 24 23:57:10 2012 +0100
@@ -16,7 +16,7 @@
 
 	printf("loaded max val  is %f\n", loadedAudioFiles[0].fileLoader.onsetDetect.onsetDetector.maximumDetectionValue);
 	
-	int multitrackToLoad = 13;
+	int multitrackToLoad = 16;
 	setDifferentMultitracks(multitrackToLoad);//command to load this set of audio files - see below
 	
 	//number 7 is problematic with memory
@@ -59,9 +59,10 @@
 		break;
 			
 		case 4:
-			kickfilename = "/Volumes/Supersaurus/TractorsAlbum/tractorsIdiotDance/tractorsSetToRecord2/Bounces/TakeTwo/kick d112_bip.wav";	
-			bassfilename = "/Volumes/Supersaurus/TractorsAlbum/tractorsIdiotDance/tractorsSetToRecord2/Bounces/TakeTwo/bass di_bip.wav";
-			snarefilename = "/Volumes/Supersaurus/TractorsAlbum/tractorsIdiotDance/tractorsSetToRecord2/Bounces/TakeTwo/snare_bip.wav";	
+			kickfilename = "/Volumes/Supersaurus/TractorsAlbum/tractorsIdiotDance/tractorsSetToRecord2/Bounces/TakeTwo/02kick_bip.wav";	
+			bassfilename = "/Volumes/Supersaurus/TractorsAlbum/tractorsIdiotDance/tractorsSetToRecord2/Bounces/TakeTwo/01bass_bip.wav";
+			snarefilename = "/Volumes/Supersaurus/TractorsAlbum/tractorsIdiotDance/tractorsSetToRecord2/Bounces/TakeTwo/03snare_bip.wav";	
+			guitarfilename = "/Volumes/Supersaurus/TractorsAlbum/tractorsIdiotDance/tractorsSetToRecord2/Bounces/TakeTwo/04guitar di_bip.wav";	
 			break;
 		case 5:
 			kickfilename = "/Users/andrew/Documents/work/Alignment/MultitrackMatch/tractorsAlign/Take12/02kick_bip.wav";
@@ -139,21 +140,34 @@
 			break;	
 			
 		case 16:
-		//	std::string folder = "/Volumes/Supersaurus/SonOfMan/FollowYourLeaders/FollowYourLeaders/Bounces/FollowMultitracks/Follow_023_D/";
 			kickfilename = "/Volumes/Supersaurus/SonOfMan/FollowYourLeaders/FollowYourLeaders/Bounces/FollowMultitracks/Follow_023_D/02Kick_D112_bip.wav";
-			bassfilename = "/Volumes/Supersaurus/SonOfMan/FollowYourLeaders/FollowYourLeaders/Bounces/FollowMultitracks/Follow_023_D/01Bass.wav";
-			snarefilename = "/Volumes/Supersaurus/SonOfMan/FollowYourLeaders/FollowYourLeaders/Bounces/FollowMultitracks/Follow_023_D//03Snare_Top_bip.wav";	
-//			guitarfilename ="/Volumes/Supersaurus/Gronk/Gronkn/Bounces/StationGateMultitracks/TakeTwoShorter/04Elec_SM57_bip.wav";	
+		//	bassfilename = "/Volumes/Supersaurus/SonOfMan/FollowYourLeaders/FollowYourLeaders/Bounces/FollowMultitracks/Follow_023_D/01Bass.wav";
+			snarefilename = "/Volumes/Supersaurus/SonOfMan/FollowYourLeaders/FollowYourLeaders/Bounces/FollowMultitracks/Follow_023_D/03Snare_Top_bip.wav";	
+			guitarfilename = "/Volumes/Supersaurus/SonOfMan/FollowYourLeaders/FollowYourLeaders/Bounces/FollowMultitracks/Follow_023_D/04Elec_SM57_bip.wav";	
+			
 			break;	
 			
+		case 17:
+			kickfilename = "/Volumes/Supersaurus/TractorsAlbum/tractorsIdiotDance/tractorsSetToRecord2/Bounces/TakeThree/02kick_bip.wav";	
+			bassfilename = "/Volumes/Supersaurus/TractorsAlbum/tractorsIdiotDance/tractorsSetToRecord2/Bounces/TakeThree/01bass_bip.wav";
+			snarefilename = "/Volumes/Supersaurus/TractorsAlbum/tractorsIdiotDance/tractorsSetToRecord2/Bounces/TakeThree/03snare_bip.wav";	
+			guitarfilename = "/Volumes/Supersaurus/TractorsAlbum/tractorsIdiotDance/tractorsSetToRecord2/Bounces/TakeThree/04guitar di_bip.wav";	
+			break;
 			
 			
 			
 			
 			
 	}
+	if (kickfilename != NULL)
 	loadAudioTrack(kickfilename, 0);
-	loadAudioTrack(bassfilename, 1);
+	
+	if (bassfilename != NULL){
+		printf("BASSfilename: %s\n", bassfilename);
+		loadAudioTrack(bassfilename, 1);
+	}
+	
+	if (snarefilename != NULL)
 	loadAudioTrack(snarefilename, 2);
 	
 	if (guitarfilename != NULL)
--- a/src/testApp.cpp	Tue Apr 24 16:37:52 2012 +0100
+++ b/src/testApp.cpp	Tue Apr 24 23:57:10 2012 +0100
@@ -38,7 +38,7 @@
 //--------------------------------------------------------------
 void testApp::update(){
 	eventMatcher.updatePosition();
-
+	
 	checkForOSCmessages();
 	
 }