Index: CLAM/src/Processing/Analysis/Tonal/FourierTransform.cxx
===================================================================
--- CLAM/src/Processing/Analysis/Tonal/FourierTransform.cxx	(revision 10210)
+++ CLAM/src/Processing/Analysis/Tonal/FourierTransform.cxx	(working copy)
@@ -22,6 +22,7 @@
 #include <cmath>
 #include "FourierTransform.hxx"
 #include <iostream>
 
 #define SWAP(a,b) do {double swaptemp=(a); (a)=(b); (b)=swaptemp;} while(false)
 
@@ -35,12 +36,40 @@
 	_spectrum.resize(2*mFrameSize);
 	#if USE_FFTW3
 	_realInput = (double*) fftw_malloc(sizeof(double) * mFrameSize);
-    _complexOutput = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * mFrameSize);
+    	_complexOutput = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * mFrameSize);
 
+	// Using fftw wisdom
+	FILE *wisdomFile; 
+	
+	// Importing previously saved wisdom
+	wisdomFile = fopen("fftw3.wisdom", "r");
+	if(wisdomFile != NULL)
+        {
+                if (-1 == fftw_import_wisdom_from_file(wisdomFile))
+                        std::cout << "Error reading wisdom!\n";
+                fclose(wisdomFile);
+	}
+
+	//clock_t start = clock(); // COMMENT THIS LINE (for checking time)
+
+	// Computing a plan, very computationally heavy (FFTW_EXHAUSTIVE) if no previous wisdom saved
 	if (isComplex)
-		_plan = fftw_plan_dft_1d(framesize, _complexOutput, _complexOutput, 1, FFTW_ESTIMATE);
+		_plan = fftw_plan_dft_1d(framesize, _complexOutput, _complexOutput, 1, FFTW_EXHAUSTIVE);
+		//_plan = fftw_plan_dft_1d(framesize, _complexOutput, _complexOutput, 1, FFTW_ESTIMATE);
 	else
-		_plan = fftw_plan_dft_r2c_1d(framesize, _realInput, _complexOutput, FFTW_ESTIMATE);
+		_plan = fftw_plan_dft_r2c_1d(framesize, _realInput, _complexOutput, FFTW_EXHAUSTIVE);
+		//_plan = fftw_plan_dft_r2c_1d(framesize, _realInput, _complexOutput, FFTW_ESTIMATE);
+		
+	//clock_t end = clock(); // COMMENT THIS LINE (for checking time)
+	//std::cout << "\nCalculating the fftw3 plan took: " << (end-start)/CLOCKS_PER_SEC << " seconds\n"; // COMMENT THIS LINE (for checking time)
+
+	// Exporting the wisdom for future use (every new plan might add something to the previous wisdom)
+	wisdomFile = fopen("fftw3.wisdom", "w");
+	if(wisdomFile!= NULL)
+	{
+		fftw_export_wisdom_to_file(wisdomFile);
+		fclose(wisdomFile);
+	}
 	#endif
 }
 