[Libxtract-commits] SF.net SVN: libxtract: [70] trunk
Status: Alpha
Brought to you by:
postlude
From: <pos...@us...> - 2007-03-14 17:20:21
|
Revision: 70 http://libxtract.svn.sourceforge.net/libxtract/?rev=70&view=rev Author: postlude Date: 2007-03-14 10:20:14 -0700 (Wed, 14 Mar 2007) Log Message: ----------- Fixed bug in xtract_spectrum() FFTW_R2HC now interpreted correctly. Updated ChangeLog and AUTHORS files. Modified Paths: -------------- trunk/AUTHORS trunk/ChangeLog trunk/TODO trunk/config.h.in trunk/configure.in trunk/src/vector.c Modified: trunk/AUTHORS =================================================================== --- trunk/AUTHORS 2007-03-13 10:14:32 UTC (rev 69) +++ trunk/AUTHORS 2007-03-14 17:20:14 UTC (rev 70) @@ -1 +1,6 @@ + +Main author: Jamie Bullock <ja...@po...> + +Fixes contributed by: +Dan Stowell Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2007-03-13 10:14:32 UTC (rev 69) +++ trunk/ChangeLog 2007-03-14 17:20:14 UTC (rev 70) @@ -1,3 +1,8 @@ +2007-03-14 Jamie Bullock <ja...@po...> + * 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 <ja...@po...> * version 0.4.0 * Added namespacing for macros and enumerations Modified: trunk/TODO =================================================================== --- trunk/TODO 2007-03-13 10:14:32 UTC (rev 69) +++ trunk/TODO 2007-03-14 17:20:14 UTC (rev 70) @@ -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! Modified: trunk/config.h.in =================================================================== --- trunk/config.h.in 2007-03-13 10:14:32 UTC (rev 69) +++ trunk/config.h.in 2007-03-14 17:20:14 UTC (rev 70) @@ -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 Modified: trunk/configure.in =================================================================== --- trunk/configure.in 2007-03-13 10:14:32 UTC (rev 69) +++ trunk/configure.in 2007-03-14 17:20:14 UTC (rev 70) @@ -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) Modified: trunk/src/vector.c =================================================================== --- trunk/src/vector.c 2007-03-13 10:14:32 UTC (rev 69) +++ trunk/src/vector.c 2007-03-14 17:20:14 UTC (rev 70) @@ -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; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |