changeset 6:b9d05eb35488

bug with loading needs fixing - if you use fullfilename for second audio file, it wont work properly...
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Fri, 04 Nov 2011 22:56:48 +0000
parents 0d51e93bfe74
children fc0a8412d6fb
files src/TimeWarp.cpp src/testApp.cpp src/testApp.h src/timeWarp.cpp
diffstat 4 files changed, 35 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/src/TimeWarp.cpp	Wed Jul 20 12:06:45 2011 +0100
+++ b/src/TimeWarp.cpp	Fri Nov 04 22:56:48 2011 +0000
@@ -650,7 +650,7 @@
 void TimeWarp::printBackwardsPath(int startIndex, int endIndex, IntMatrix* backPath){
 	if (endIndex <= (*backPath)[0].size()){
 	for (int i = startIndex;i < endIndex;i++){
-		printf("PRINT path index %i:  path: %i : %i \n", i, (*backPath)[0][i], (*backPath)[1][i]);
+		printf("Path[%i]:: %i : %i \n", i, (*backPath)[0][i], (*backPath)[1][i]);
 		}
 	}
 }
--- a/src/testApp.cpp	Wed Jul 20 12:06:45 2011 +0100
+++ b/src/testApp.cpp	Fri Nov 04 22:56:48 2011 +0000
@@ -89,13 +89,28 @@
 	onset = new OnsetDetectionFunction(512,1024,6,1);
 	
 	//loading audio files
-	loadSoundFiles();			
+	//loadSoundFiles();	
+	//this os load soundfiles
 	
-	soundFileName = "../../../data/sound/Bach_short2.wav";
+	string fullFileName = "/Users/andrew/Documents/work/programming/of_preRelease_v0061_osx_FAT/apps/my_openFrameworks/chromaReader13audioTimeWarp3/bin/data/sound/Bach_short1.wav";
 	
-	loadFirstAudioFile();
+	loadNewAudio(fullFileName);
+	/*
+	const char	*infile_name = fullFileName.c_str();// "../../../data/sound/Bach_short1.wav";	//
+	
+	 loadLibSndFile(infile_name);
+	 
+	string loadfilename = fullFileName;//"sound/Bach_short1.wav";//
+	 loadedAudio.loadSound(loadfilename);
+	playingAudio = &loadedAudio;
+	 //end load soninf ifiels
+
+	processAudioToDoubleMatrix(&tw.chromaMatrix, &tw.firstEnergyVector);
+	
+	*/
 	
 	secondFileName = "../../../data/sound/Bach_short2.wav";
+	
 
 	loadSecondAudio(secondFileName);//i.e. load same as first file
 	
@@ -137,11 +152,11 @@
 	printf("JOINT SIMILARITY TAKES %f\n", elapsedTime);
 	//this has been replaced by the joint function
 	
-
-	timeBefore = ofGetElapsedTimef();
-	tw.calculateSimilarityMatrixWithPointers(&tw.firstChromaEnergyMatrix, &tw.secondChromaEnergyMatrix, &tw.similarityMatrix);
-	elapsedTime = ofGetElapsedTimef() - timeBefore;
-	printf("CREATING BIG SIMILARITY MATRIX TAKES %f\n", elapsedTime);
+	//	the big similarity measure
+	//timeBefore = ofGetElapsedTimef();
+	//tw.calculateSimilarityMatrixWithPointers(&tw.firstChromaEnergyMatrix, &tw.secondChromaEnergyMatrix, &tw.similarityMatrix);
+	//elapsedTime = ofGetElapsedTimef() - timeBefore;
+	//printf("CREATING BIG SIMILARITY MATRIX TAKES %f\n", elapsedTime);
 	//bug is here above - needed to make sim matrix visible
 	
 	//new fn
@@ -188,7 +203,7 @@
 			printf("Alignment[%i] : %f\n", i, tw.alignmentMeasureMatrix[tw.similarityMatrix.size()-1][i]);
 		}
 */
-	printf("\n PART ALIGNMENT \n");
+	printf("\n CALC PART ALIGNMENT MIN PATH\n");
 	tw.calculateMinimumAlignmentPath(&tw.tmpAlignmentMeasureMatrix, &tw.tmpBackwardsPath, true);//true is for greedy calculation
 	printf("\n PART ALIGNMENT GENERATES THIS BACKWARDS PATH:: \n");
 	tw.extendForwardAlignmentPath(hopsize, &tw.tmpBackwardsPath, startFrameX, startFrameY);
@@ -1300,12 +1315,11 @@
 
 
 void testApp::loadNewAudio(string soundFileName){
-
+	
 	loadedAudio.loadSound(soundFileName);
-	
+	playingAudio = &loadedAudio;
 	//snd file method
 	const char	*infilename = soundFileName.c_str() ;
-	
 	loadLibSndFile(infilename);
 	
 	loadFirstAudioFile();
@@ -1326,20 +1340,21 @@
 	eptr = &(tw.firstEnergyVector);
 	*/
 	processAudioToDoubleMatrix(&tw.chromaMatrix, &tw.firstEnergyVector);
+	/*
 	double timeBefore = ofGetElapsedTimef();
 	tw.createCombinedMatrix(tw.chromaMatrix, tw.firstEnergyVector, &tw.firstChromaEnergyMatrix);
 	double elapsedTime = ofGetElapsedTimef() - timeBefore;
 	printf("CREATING JOINT MATRIX for FIRST ENERGY and chroma TAKES %f\n", elapsedTime);
-	
+	*/
 	
 }
 
-void testApp::loadSecondAudio(string soundFileName){
+void testApp::loadSecondAudio(string sndFileName){
 
-	secondAudio.loadSound(soundFileName);
+	secondAudio.loadSound(sndFileName);
 
-	const char	*infilename = soundFileName.c_str() ;	
-	loadLibSndFile(infilename);
+	const char	*infilenme = sndFileName.c_str() ;	
+	loadLibSndFile(infilenme);
 
 /*	Chromagram* cptr;
 	DoubleMatrix* dptr;
--- a/src/testApp.h	Wed Jul 20 12:06:45 2011 +0100
+++ b/src/testApp.h	Fri Nov 04 22:56:48 2011 +0000
@@ -123,7 +123,7 @@
 		void processAudioToDoubleMatrix(DoubleMatrix* myDoubleMatrix, DoubleVector* energyVector);
 	
 		void loadNewAudio(string soundFileName);
-		void loadSecondAudio(string soundFileName);
+		void loadSecondAudio(string sndFileName);
 		
 		void loadSoundFiles();
 		void openFileDialogBox();
--- a/src/timeWarp.cpp	Wed Jul 20 12:06:45 2011 +0100
+++ b/src/timeWarp.cpp	Fri Nov 04 22:56:48 2011 +0000
@@ -650,7 +650,7 @@
 void TimeWarp::printBackwardsPath(int startIndex, int endIndex, IntMatrix* backPath){
 	if (endIndex <= (*backPath)[0].size()){
 	for (int i = startIndex;i < endIndex;i++){
-		printf("PRINT path index %i:  path: %i : %i \n", i, (*backPath)[0][i], (*backPath)[1][i]);
+		printf("Path[%i]:: %i : %i \n", i, (*backPath)[0][i], (*backPath)[1][i]);
 		}
 	}
 }