changeset 67:2c2ea9326c30

Fixed bug in xtract_spectrum() FFTW_R2HC now interpreted correctly. Updated ChangeLog and AUTHORS files.
author Jamie Bullock <jamie@postlude.co.uk>
date Wed, 14 Mar 2007 17:20:14 +0000
parents af594496da53
children 9de5628b69a8
files AUTHORS ChangeLog TODO config.h.in configure.in src/vector.c
diffstat 6 files changed, 46 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/AUTHORS	Tue Mar 13 10:14:32 2007 +0000
+++ b/AUTHORS	Wed Mar 14 17:20:14 2007 +0000
@@ -1,1 +1,6 @@
+
+Main author:
 Jamie Bullock <jamie@postlude.co.uk>
+
+Fixes contributed by:
+Dan Stowell
--- a/ChangeLog	Tue Mar 13 10:14:32 2007 +0000
+++ b/ChangeLog	Wed Mar 14 17:20:14 2007 +0000
@@ -1,3 +1,8 @@
+2007-03-14 Jamie Bullock <jamie@postlude.co.uk>
+    * version 0.4.4
+	* Fixed return value macros for functions if fftw not used
+	* Fixed bug in xtract_spectrum() FFTW_R2HC not interpreted correctly
+
 2007-01-29 Jamie Bullock <jamie@postlude.co.uk>
     * version 0.4.0
 	* Added namespacing for macros and enumerations
--- a/TODO	Tue Mar 13 10:14:32 2007 +0000
+++ b/TODO	Wed Mar 14 17:20:14 2007 +0000
@@ -4,12 +4,10 @@
 Add spectral_mean, spectral_deviation, spectral_geometric_mean etc.
 Add weighted temporal features as per Peeters (xtract_weighted_mean etc) weight given as argv?
 Improve noise robustness of xtract_f0
-Add feature advertisement
 Fix xtract_hps - it doesn't work!
 Add Pure Data help file
 Add delta functions
 Add Max/MSP external example
-Add self documentation
 Check and add return values as appropriate. Make them more sensible!
 ...do other stuff and eventually...
 ...optimise!
--- a/config.h.in	Tue Mar 13 10:14:32 2007 +0000
+++ b/config.h.in	Wed Mar 14 17:20:14 2007 +0000
@@ -18,8 +18,8 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
-/* Define to 1 if you have the <math.h */
-#undef HAVE_MATH_H
+/* Define to 1 if you have the <math.h,> header file. */
+#undef HAVE_MATH_H_
 
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
@@ -30,9 +30,12 @@
 /* Define to 1 if you have the <stdio.h> header file. */
 #undef HAVE_STDIO_H
 
-/* Define to 1 if you have the <stdlib.h */
+/* Define to 1 if you have the <stdlib.h> header file. */
 #undef HAVE_STDLIB_H
 
+/* Define to 1 if you have the <stdlib.h,> header file. */
+#undef HAVE_STDLIB_H_
+
 /* Define to 1 if you have the <strings.h> header file. */
 #undef HAVE_STRINGS_H
 
--- a/configure.in	Tue Mar 13 10:14:32 2007 +0000
+++ b/configure.in	Wed Mar 14 17:20:14 2007 +0000
@@ -4,7 +4,7 @@
 # Increment for feature additions and enhancements
 m4_define(libxtract_minor_version, 4)
 # Increment for fixes 
-m4_define(libxtract_fix_version, 2)
+m4_define(libxtract_fix_version, 4)
 
 m4_define(libxtract_version, libxtract_major_version.libxtract_minor_version.libxtract_fix_version)
 		
--- a/src/vector.c	Tue Mar 13 10:14:32 2007 +0000
+++ b/src/vector.c	Wed Mar 14 17:20:14 2007 +0000
@@ -55,49 +55,63 @@
     fftwf_execute(plan);
 
     switch(vector){
-	case XTRACT_MAGNITUDE_SPECTRUM:
-	    for(n = 0; n < M; n++){
-		result[n] = sqrt(XTRACT_SQ(rfft[n]) + XTRACT_SQ(rfft[N - n])) / N; 
+
+/*	case XTRACT_MAGNITUDE_SPECTRUM:
+	    for(n = 1; n < M; n++){
+		result[n] = sqrt(XTRACT_SQ(rfft[n]) + 
+			XTRACT_SQ(rfft[N - n - 1])) / N; 
 		result[M + n] = n * q;
 	    }
 	    break;
+*/
 	case XTRACT_LOG_MAGNITUDE_SPECTRUM:
-	    for(n = 0; n < M; n++){
-		if ((temp = XTRACT_SQ(rfft[n]) + XTRACT_SQ(rfft[N - n])) > XTRACT_LOG_LIMIT)
+	    for(n = 1; n < M; n++){
+		if ((temp = XTRACT_SQ(rfft[n]) + 
+			    XTRACT_SQ(rfft[N - n - 1])) > XTRACT_LOG_LIMIT)
 		    temp = log(sqrt(temp) / N);
 		else
 		    temp = XTRACT_LOG_LIMIT_DB;
 		/*Normalise*/
-		result[n] = (temp + XTRACT_DB_SCALE_OFFSET) / XTRACT_DB_SCALE_OFFSET; 
+		result[n] = 
+		    (temp + XTRACT_DB_SCALE_OFFSET) / XTRACT_DB_SCALE_OFFSET; 
 		result[M + n] = n * q;
 	    }
 	    break;
+
 	case XTRACT_POWER_SPECTRUM:
-	    for(n = 0; n < M; n++){
-		result[n] = (XTRACT_SQ(rfft[n]) + XTRACT_SQ(rfft[N - n])) / NxN;
+	    for(n = 1; n < M; n++){
+		result[n] = (XTRACT_SQ(rfft[n]) + XTRACT_SQ(rfft[N - n - 1])) 
+		    / NxN;
 		result[M + n] = n * q;
 	    }
 	    break;
+
 	case XTRACT_LOG_POWER_SPECTRUM:
-	    for(n = 0; n < M; n++){
-		if ((temp = XTRACT_SQ(rfft[n]) + XTRACT_SQ(rfft[N - n])) > XTRACT_LOG_LIMIT)
+	    for(n = 1; n < M; n++){
+		if ((temp = XTRACT_SQ(rfft[n]) + XTRACT_SQ(rfft[N - n - 1])) > 
+			XTRACT_LOG_LIMIT)
 		    temp = log(temp / NxN);
 		else
 		    temp = XTRACT_LOG_LIMIT_DB; 		
-		result[n] = (temp + XTRACT_DB_SCALE_OFFSET) / XTRACT_DB_SCALE_OFFSET; 
+		result[n] = (temp + XTRACT_DB_SCALE_OFFSET) / 
+		    XTRACT_DB_SCALE_OFFSET; 
 		result[M + n] = n * q;
 	    }
 	    break;
+
 	default:
 	    /* MAGNITUDE_SPECTRUM */
-	    for(n = 0; n < M; n++){
-		result[n] = sqrt(XTRACT_SQ(rfft[n]) + XTRACT_SQ(rfft[N - n])) / N; 
+	    for(n = 1; n < M; n++){
+		result[n] = sqrt(XTRACT_SQ(rfft[n]) + 
+			XTRACT_SQ(rfft[N - n - 1])) / N; 
 		result[M + n] = n * q;
 	    }
 	    break;
     }
     
-    /* result[0] = fabs(temp[0]) / N  */
+    /* Set the DC component to 0 */
+    result[0] = result[M] = 0.f;
+    /* Set the Nyquist */
     result[N] = q * M;
     
     fftwf_destroy_plan(plan);
@@ -182,7 +196,7 @@
 
 #else
 
-int xtract_magnitude_spectrum(const float *data, const int N, const void *argv, float *result){
+int xtract_spectrum(const float *data, const int N, const void *argv, float *result){
 
     XTRACT_NEEDS_FFTW;
     return XTRACT_NO_RESULT;