diff options
-rw-r--r-- | AUTHORS | 5 | ||||
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | config.h.in | 9 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | src/vector.c | 44 |
6 files changed, 46 insertions, 21 deletions
@@ -1 +1,6 @@ + +Main author: Jamie Bullock <jamie@postlude.co.uk> + +Fixes contributed by: +Dan Stowell @@ -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 @@ -4,12 +4,10 @@ Add geometric_mean 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! diff --git a/config.h.in b/config.h.in index b05b0e5..babd7f3 100644 --- a/config.h.in +++ b/config.h.in @@ -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 diff --git a/configure.in b/configure.in index a66f0b7..9c3c27b 100644 --- a/configure.in +++ b/configure.in @@ -4,7 +4,7 @@ m4_define(libxtract_major_version, 0) # 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) diff --git a/src/vector.c b/src/vector.c index b6b9308..2f54a3c 100644 --- a/src/vector.c +++ b/src/vector.c @@ -55,49 +55,63 @@ int xtract_spectrum(const float *data, const int N, const void *argv, float *res 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 @@ int xtract_dct(const float *data, const int N, const void *argv, float *result){ #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; |