changeset 54:9762d7e3d129

Fleshed out function descriptors.
author Jamie Bullock <jamie@postlude.co.uk>
date Thu, 11 Jan 2007 16:37:50 +0000
parents 04f536b139a8
children 4ea1a8838b14
files configure.in examples/puredata/xtract~.c src/descriptors.c src/libxtract.c src/scalar.c src/vector.c xtract/libxtract.h xtract/xtract_macros.h xtract/xtract_scalar.h xtract/xtract_vector.h
diffstat 10 files changed, 203 insertions(+), 54 deletions(-) [+]
line wrap: on
line diff
--- a/configure.in	Wed Jan 10 14:36:43 2007 +0000
+++ b/configure.in	Thu Jan 11 16:37:50 2007 +0000
@@ -64,7 +64,7 @@
 # age to 0.
 XTRACT_SO_VERSION=0:0:0
 
-CFLAGS="$CFLAGS -pedantic -ansi -Wall -std=c99"
+CFLAGS="$CFLAGS -pedantic -ansi -Wall -Werror -std=c99"
 LDFLAGS="$LDFLAGS -lm"
 
 AC_ARG_WITH(pd_dir,
@@ -132,7 +132,7 @@
 if test "$with_debug" = "yes"
 then
   AC_DEFINE(DEBUG,1,[Define to enable debug])
-  CFLAGS="-O0 -ggdb -g -pedantic -ansi -Wall"
+  CFLAGS="$CFLAGS -O0 -ggdb -g"
 fi
 
 dnl ------------------------------------------
@@ -164,7 +164,7 @@
 
         case $host in
         *86-*-linux*)
-                PD_CFLAGS="$PD_CFLAGS -DUNIX -Wall -Wimplicit -Wunused -Wmissing-prototypes"
+                PD_CFLAGS="$PD_CFLAGS -DUNIX -Wall -Wimplicit -Wunused"
         PD_LDFLAGS="$PD_LDFLAGS -shared -export_dynamic"
         dnl we could test for bad glibc here, but don't
         PD_SUFFIX=pd_linux
--- a/examples/puredata/xtract~.c	Wed Jan 10 14:36:43 2007 +0000
+++ b/examples/puredata/xtract~.c	Thu Jan 11 16:37:50 2007 +0000
@@ -194,7 +194,7 @@
     if(x->feature == AUTOCORRELATION || x->feature == AUTOCORRELATION_FFT ||
     x->feature == MFCC || x->feature == AMDF || x->feature == ASDF|| 
     x->feature == DCT || x->feature == BARK_COEFFICIENTS || 
-    x->feature == MAGNITUDE_SPECTRUM || x->feature == PEAK_SPECTRUM || 
+    x->feature == SPECTRUM || x->feature == PEAK_SPECTRUM || 
     x->feature == HARMONIC_SPECTRUM) 
         x->feature_type = VECTOR;
                 
--- a/src/descriptors.c	Wed Jan 10 14:36:43 2007 +0000
+++ b/src/descriptors.c	Thu Jan 11 16:37:50 2007 +0000
@@ -30,6 +30,8 @@
     int f , F;
     char *name, *p_name, *desc, *p_desc, *author;
     int *argc, *year;
+    t_vector *data_format; 
+    /* *result_format; */
 
     f = F = XTRACT_FEATURES;
 
@@ -54,7 +56,6 @@
 	    case  SPECTRAL_AVERAGE_DEVIATION:
 	    case  ROLLOFF:
 	    case  SPECTRAL_INHARMONICITY:
-	    case  MAGNITUDE_SPECTRUM:
 	    case  ODD_EVEN_RATIO:
 	    case  LOWEST_VALUE:
 	    case  F0:
@@ -67,6 +68,7 @@
 	    case  KURTOSIS:
 	    case  SPECTRAL_SKEWNESS:
 	    case  SPECTRAL_KURTOSIS:
+	    case  SPECTRUM:
 	    case  PEAK_SPECTRUM:
 	    case  HARMONIC_SPECTRUM:
 	    case  NOISINESS:
@@ -116,6 +118,86 @@
 		break;
 	}
 
+        data_format = &d->data.format;
+
+	switch(f){
+
+	    case  MEAN: 
+	    case  VARIANCE:
+	    case  STANDARD_DEVIATION:
+	    case  AVERAGE_DEVIATION:
+	    case  SKEWNESS:
+	    case  KURTOSIS:
+	    case  LOWEST_VALUE:
+	    case  HIGHEST_VALUE:
+	    case  SUM:
+	    case  ZCR:
+		*data_format = ARBITRARY_SERIES;
+		break;
+	    case  SPECTRAL_MEAN:
+	    case  SPECTRAL_VARIANCE:
+	    case  SPECTRAL_STANDARD_DEVIATION:
+	    case  SPECTRAL_AVERAGE_DEVIATION:
+	    case  SPECTRAL_SKEWNESS:
+	    case  SPECTRAL_KURTOSIS:
+	    case  SPECTRAL_CENTROID:
+	    case  SPECTRAL_SLOPE:
+	    case  PEAK_SPECTRUM:
+	    case  HARMONIC_SPECTRUM:
+	        *data_format = SPECTRAL;     
+		break;
+	    case  ROLLOFF:
+	    case  NOISINESS:
+	    case  BARK_COEFFICIENTS:
+	    case  CREST:
+	    case  IRREGULARITY_K:
+	    case  IRREGULARITY_J:
+	    case  SMOOTHNESS:
+	    case  FLATNESS:
+	    case  SPREAD:
+	    case  RMS_AMPLITUDE:
+	    case  POWER:
+	    case  SHARPNESS:
+	    case  HPS:
+		*data_format = SPECTRAL_MAGNITUDES;
+		break;
+	    case  SPECTRAL_INHARMONICITY:
+		*data_format = SPECTRAL_PEAKS;
+		break;
+	    case  ODD_EVEN_RATIO:
+		*data_format = SPECTRAL_HARMONICS_FREQUENCIES;
+		break;
+	    case  F0:
+	    case  FAILSAFE_F0:
+	    case  SPECTRUM:
+	    case  MFCC:
+	    case  AUTOCORRELATION:
+	    case  AUTOCORRELATION_FFT:
+	    case  DCT:
+	    case  AMDF:
+	    case  ASDF:
+		*data_format = AUDIO_SAMPLES;
+		break;
+	    case  TONALITY:
+		*data_format = NO_DATA;
+		break;
+	    case  TRISTIMULUS_1:
+	    case  TRISTIMULUS_2:
+	    case  TRISTIMULUS_3:
+		*data_format = SPECTRAL_HARMONICS_MAGNITUDES;
+		break;
+	    case  LOUDNESS:
+		*data_format = BARK_COEFFS;
+		break;
+	    case  FLUX: 
+	    case  ATTACK_TIME: 
+	    case  DECAY_TIME: 
+	    case  DELTA_FEATURE: 
+	    default:
+		*data_format = NO_DATA;
+		break;
+	}
+
 	name = d->algo.name;
 	p_name = d->algo.p_name;
 	desc = d->algo.desc;
@@ -207,13 +289,13 @@
 		strcpy(p_desc, 
 			"Extract the inharmonicity of an audio spectrum");
 		break;
-	    case  MAGNITUDE_SPECTRUM:
-		strcpy(name, "magnitude_spectrum");
-		strcpy(p_name, "Magnitude Spectrum");
+	    case  SPECTRUM:
+		strcpy(name, "spectrum");
+		strcpy(p_name, "Spectrum");
 		strcpy(desc, 
-			"Extract the magnitude spectrum of an input vector");
+			"Extract the spectrum of an input vector");
 		strcpy(p_desc, 
-			"Extract the magnitude spectrum of an audio signal");
+			"Extract the spectrum of an audio signal");
 		strcpy(author, "");
 		break;
 	    case  ODD_EVEN_RATIO:
--- a/src/libxtract.c	Wed Jan 10 14:36:43 2007 +0000
+++ b/src/libxtract.c	Thu Jan 11 16:37:50 2007 +0000
@@ -74,7 +74,7 @@
     xtract_asdf,
     xtract_bark_coefficients,
     xtract_peak_spectrum,
-    xtract_magnitude_spectrum,
+    xtract_spectrum,
     xtract_autocorrelation_fft,
     xtract_mfcc,
     xtract_dct,
--- a/src/scalar.c	Wed Jan 10 14:36:43 2007 +0000
+++ b/src/scalar.c	Thu Jan 11 16:37:50 2007 +0000
@@ -778,7 +778,7 @@
 
 	magnitudes = (float *)malloc(N * sizeof(float));
 	peaks = (float *)malloc(N * sizeof(float));
-	xtract_magnitude_spectrum(data, N, argv, magnitudes);
+	xtract_spectrum(data, N, argv, magnitudes);
 	argf[0] = 10.f;
 	argf[1] = *(float *)argv;
 	xtract_peak_spectrum(magnitudes, N, argf, peaks);
--- a/src/vector.c	Wed Jan 10 14:36:43 2007 +0000
+++ b/src/vector.c	Thu Jan 11 16:37:50 2007 +0000
@@ -30,35 +30,77 @@
 
 #include <fftw3.h>
 
-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){
 
-    float *temp, *input, q;
+    float *input, *rfft, q, temp;
     size_t bytes;
-    int n , M = N >> 1;
+    int n , NxN, M, vector;
     fftwf_plan plan;
 
-    temp = (float *)fftwf_malloc(N * sizeof(float));
+    M = N >> 1;
+    NxN = SQ(N);
+
+    rfft = (float *)fftwf_malloc(N * sizeof(float));
     input = (float *)malloc(bytes = N * sizeof(float));
     input = memcpy(input, data, bytes);
 
     q = *(float *)argv;
+    vector = (int)*((float *)argv+1);
 
     CHECK_q;
 
-    plan = fftwf_plan_r2r_1d(N, input, temp, FFTW_R2HC, FFTW_ESTIMATE);
+    plan = fftwf_plan_r2r_1d(N, input, rfft, FFTW_R2HC, FFTW_ESTIMATE);
     
     fftwf_execute(plan);
-    
-    for(n = 1; n < M; n++){
-        result[n] = sqrt(SQ(temp[n]) + SQ(temp[N - n])) / N;
-        result[M + n] = n * q;
+
+    switch(vector){
+	case MAGNITUDE_SPECTRUM:
+	    for(n = 0; n < M; n++){
+		result[n] = sqrt(SQ(rfft[n]) + SQ(rfft[N - n])) / N; 
+		result[M + n] = n * q;
+	    }
+	    break;
+	case LOG_MAGNITUDE_SPECTRUM:
+	    for(n = 0; n < M; n++){
+		if ((temp = SQ(rfft[n]) + SQ(rfft[N - n])) > LOG_LIMIT)
+		    temp = log(sqrt(temp) / N);
+		else
+		    temp = LOG_LIMIT_DB;
+		/*Normalise*/
+		result[n] = (temp + DB_SCALE_OFFSET) / DB_SCALE_OFFSET; 
+		result[M + n] = n * q;
+	    }
+	    break;
+	case POWER_SPECTRUM:
+	    for(n = 0; n < M; n++){
+		result[n] = (SQ(rfft[n]) + SQ(rfft[N - n])) / NxN;
+		result[M + n] = n * q;
+	    }
+	    break;
+	case LOG_POWER_SPECTRUM:
+	    for(n = 0; n < M; n++){
+		if ((temp = SQ(rfft[n]) + SQ(rfft[N - n])) > LOG_LIMIT)
+		    temp = log(temp / NxN);
+		else
+		    temp = LOG_LIMIT_DB; 		
+		result[n] = (temp + DB_SCALE_OFFSET) / DB_SCALE_OFFSET; 
+		result[M + n] = n * q;
+	    }
+	    break;
+	default:
+	    /* MAGNITUDE_SPECTRUM */
+	    for(n = 0; n < M; n++){
+		result[n] = sqrt(SQ(rfft[n]) + SQ(rfft[N - n])) / N; 
+		result[M + n] = n * q;
+	    }
+	    break;
     }
     
-    result[0] = fabs(temp[0]) / N;
+    /* result[0] = fabs(temp[0]) / N  */
     result[M] = q * .5;
     
     fftwf_destroy_plan(plan);
-    fftwf_free(temp);
+    fftwf_free(rfft);
     free(input);
     
     return SUCCESS;
--- a/xtract/libxtract.h	Wed Jan 10 14:36:43 2007 +0000
+++ b/xtract/libxtract.h	Thu Jan 11 16:37:50 2007 +0000
@@ -105,7 +105,7 @@
     ASDF,
     BARK_COEFFICIENTS,
     PEAK_SPECTRUM,
-    MAGNITUDE_SPECTRUM,
+    SPECTRUM,
     AUTOCORRELATION_FFT,
     MFCC,
     DCT,
@@ -135,6 +135,14 @@
     FEATURE_NOT_IMPLEMENTED
 };
 
+/** \brief Enumeration of spectrum types */
+enum spectrum_ {
+    MAGNITUDE_SPECTRUM,
+    LOG_MAGNITUDE_SPECTRUM,
+    POWER_SPECTRUM,
+    LOG_POWER_SPECTRUM
+};
+
 /** \brief Enumeration of data types*/
 typedef enum type_ {
     FLOAT,
@@ -156,12 +164,27 @@
 
 /** \brief Enumeration of vector format types*/
 typedef enum vector_ {
-    MAGNITUDES,
-    FREQUENCIES,
-    FREQUENCIES_AND_MAGNITUDES,
+    /* N/2 magnitude/log-magnitude/power/log-power coeffs and N/2 frequencies */
+    SPECTRAL,     
+    /* N spectral amplitudes */
+    SPECTRAL_MAGNITUDES, 
+    /* N/2 magnitude/log-magnitude/power/log-power peak coeffs and N/2 
+     * frequencies */
+    SPECTRAL_PEAKS,
+    /* N spectral peak amplitudes */
+    SPECTRAL_PEAK_MAGNITUDES,
+    /* N/2 magnitude/log-magnitude/power/log-power harmonic peak coeffs and N/2 
+     * frequencies */
+    SPECTRAL_HARMONICS,
+    /* N spectral harmonic amplitudes */
+    SPECTRAL_HARMONICS_MAGNITUDES,
+    /* N spectral harmonic frequencies */
+    SPECTRAL_HARMONICS_FREQUENCIES,
+    ARBITRARY_SERIES,
+    AUDIO_SAMPLES,
+    MEL_COEFFS, 
     BARK_COEFFS,
-    MEL_COEFFS,
-    SAMPLES,
+    NO_DATA
 } t_vector;
 
 /** \brief Data structure containing useful information about functions provided by LibXtract. */
--- a/xtract/xtract_macros.h	Wed Jan 10 14:36:43 2007 +0000
+++ b/xtract/xtract_macros.h	Thu Jan 11 16:37:50 2007 +0000
@@ -37,9 +37,11 @@
 #define NEEDS_FFTW printf("LibXtract must be compiled with fftw support to use this function.\n")
 #define CHECK_q if(!q) q = 44100.f / N
 
-#define VERY_SMALL_NUMBER 1e-20
+#define VERY_SMALL_NUMBER 2e-42
 #define LOG_LIMIT VERY_SMALL_NUMBER
-#define VERY_BIG_NUMBER 1e20
+#define LOG_LIMIT_DB -96
+#define DB_SCALE_OFFSET 96
+#define VERY_BIG_NUMBER 2e42
 #define SR_LIMIT 192000
 #define BARK_BANDS 26
 #define NONE 0
--- a/xtract/xtract_scalar.h	Wed Jan 10 14:36:43 2007 +0000
+++ b/xtract/xtract_scalar.h	Thu Jan 11 16:37:50 2007 +0000
@@ -157,7 +157,7 @@
 
 /** \brief Calculate the Irregularity of an input vector using a method described by Krimphoff (1994)
  * 
- * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients from the magnitude spectrum of an audio vector, (e.g. the second half of the array pointed to by *result from xtract_magnitude_spectrum().
+ * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients from the spectrum of an audio vector, (e.g. the first half of the array pointed to by *result from xtract_spectrum().
  * \param N: the number of elements to be considered
  * \param *argv: a pointer to NULL
  * \param *result: the irregularity of N values from the array pointed to by *data
@@ -166,7 +166,7 @@
 
 /** \brief Calculate the Irregularity of an input vector using a method described by Jensen (1999)
  * 
- * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients from the magnitude spectrum of an audio vector, (e.g. the second half of the array pointed to by *result from xtract_magnitude_spectrum().
+ * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients from the spectrum of an audio vector, (e.g. the first half of the array pointed to by *result from xtract_spectrum().
  * \param N: the number of elements to be considered
  * \param *argv: a pointer to NULL
  * \param *result: the irregularity of N values from the array pointed to by *data
@@ -175,7 +175,7 @@
 
 /** \brief Calculate the Tristimulus of an input vector using a method described by Pollard and Jansson (1982)
  * 
- * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients of the harmonic spectrum of an audio vector e.g. a pointer to the second half of the array pointed to by *result from xtract_harmonics(). The amplitudes of the peak spectrum (e.g. *result from xtract_peaks()) can be used if one wishes to consider all partials not just harmonics.
+ * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients of the harmonic spectrum of an audio vector e.g. a pointer to the first half of the array pointed to by *result from xtract_harmonics(). The amplitudes of the peak spectrum (e.g. *result from xtract_spectral_peaks()) can be used if one wishes to consider all partials not just harmonics.
  * \param N: the number of elements to be considered
  * \param *argv: a pointer to NULL
  * \param *result: the tristimulus of N values from the array pointed to by *data
@@ -189,7 +189,7 @@
 
 /** \brief Extract the smoothness of an input vector using a method described by McAdams (1999)
  * 
- * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients from the magnitude spectrum of an audio vector, (e.g. the second half of the array pointed to by *result from xtract_magnitude_spectrum().
+ * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients from the spectrum of an audio vector, (e.g. the first half of the array pointed to by *result from xtract_spectrum().
  * \param N: the number of elements to be considered
  * \param *argv: a pointer to the first element of an array of integers containing the lower bound, upper bound, and pre-scaling factor, whereby array data in the range lower < n < upper will be pre-scaled by p before processing. 
  * \param *result: the smoothness of N values from the array pointed to by *data
@@ -198,7 +198,7 @@
 
 /** \brief Extract the spectral spread of an input vector using a method described by Casagrande(2005)
  * 
- * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients from the magnitude spectrum of an audio vector, (e.g. the second half of the array pointed to by *result from xtract_magnitude_spectrum().
+ * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients from the spectrum of an audio vector, (e.g. the first half of the array pointed to by *result from xtract_spectrum().
  * \param N: the number of elements to be considered
  * \param *argv: a pointer to NULL
  * \param *result: the spectral spread of N values from the array pointed to by *data
@@ -218,7 +218,7 @@
 
 /** \brief Extract the spectral rolloff of an input vector using a method described by Bee Suan Ong (2005)
  * 
- * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients from the magnitude spectrum of an audio vector, (e.g. the second half of the array pointed to by *result from xtract_magnitude_spectrum().
+ * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients from the spectrum of an audio vector, (e.g. the first half of the array pointed to by *result from xtract_spectrum().
  * \param N: the number of elements to be considered
  * \param *argv: a pointer to an array containing a floating point value representing the threshold for rolloff, i.e. the percentile at which the rolloff is determined, expressed in the range 0-1.0, and a float representing the sample rate in Hz
  * \param *result: the spectral rolloff in Hz of N values from the array pointed to by *data. This is the point in the spectrum below which argv[0] of the energy is distributed.
@@ -239,7 +239,7 @@
 
 /** \brief Extract the spectral flatness measure of an input vector using a method described by Tristan Jehan (2005)
  * 
- * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients from the magnitude spectrum of an audio vector, (e.g. the second half of the array pointed to by *result from xtract_magnitude_spectrum().
+ * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients from the spectrum of an audio vector, (e.g. the first half of the array pointed to by *result from xtract_spectrum().
  * \param N: the number of elements to be considered
  * \param *argv: a pointer to NULL
  * \param *result: the spectral flatness of N values from the array pointed to by *data
@@ -258,7 +258,7 @@
 
 /** \brief Extract the noisiness of an input vector using a method described by Tae Hong Park (2000)
  * 
- * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients from the magnitude spectrum of an audio vector, (e.g. the second half of the array pointed to by *result from xtract_magnitude_spectrum().
+ * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients from the spectrum of an audio vector, (e.g. the first half of the array pointed to by *result from xtract_spectrum().
  * \param N: the number of elements to be considered
  * \param *argv: a pointer to NULL
  * \param *result: the noisiness of N values from the array pointed to by *data
@@ -276,7 +276,7 @@
 
 /** \brief Extract the Inharmonicity of an input vector 
  * 
- * \param *data: a pointer to the first element in an array of floats represeting a frequency spectrum of size N/2 and a magnitude peak spectrum of size N/2 (This is the output format of xtract_peaks)
+ * \param *data: a pointer to the first element in an array of floats represeting a magnitude peak spectrum of size N/2, and a frequency spectrum of size N/2 (This is the output format of xtract_spectral_peaks())
  * \param N: the number of elements to be considered
  * \param *argv: a pointer to a float representing the fundamental frequency of the input vector.
  * \param *result: the inharmonicity of N values from the array pointed to by *data
@@ -285,7 +285,7 @@
 
 /** \brief Extract the spectral crest of an input vector using a method described by Peeters (2003)
  * 
- * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients from the magnitude spectrum of an audio vector, (e.g. the second half of the array pointed to by *result from xtract_magnitude_spectrum().
+ * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients from the spectrum of an audio vector, (e.g. the first half of the array pointed to by *result from xtract_spectrum().
  * \param N: the number of elements to be considered
  * \param *argv: a pointer to NULL
  * \param *result: the spectral crest of N values from the array pointed to by *data
@@ -294,7 +294,7 @@
     
 /** \brief Extract the Spectral Power of an input vector using a method described by Bee Suan Ong (2005)
  * 
- * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients from the magnitude spectrum of an audio vector, (e.g. the second half of the array pointed to by *result from xtract_magnitude_spectrum().
+ * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients from the spectrum of an audio vector, (e.g. the first half of the array pointed to by *result from xtract_spectrum().
  * \param N: the number of elements to be considered
  * \param *argv: a pointer to NULL
  * \param *result: the spectral power of N values from the array pointed to by *data
@@ -304,7 +304,7 @@
 /* Odd to even harmonic ratio */
 /** \brief Extract the Odd to even harmonic ratio of an input vector 
  * 
- * \param *data: a pointer to the first element in an array of floats representing the frequencies of the harmonic spectrum of an audio vector. It is sufficient to pass in a pointer to the array pointed to by *result from xtract_harmonics.
+ * \param *data: a pointer to the first element in an array of floats representing the frequencies of the harmonic spectrum of an audio vector. It is sufficient to pass in a pointer to the second half of the array pointed to by *result from xtract_harmonic_spectrum().
  * \param N: the number of elements to be considered. If using the array pointed to by *result from xtract_harmonics, N should equal half the total array size i.e., just the frequencies of the peaks.
  * \param *argv: a pointer to NULL
  * \param *result: the odd/even harmonic ratio of N values from the array pointed to by *data
@@ -313,7 +313,7 @@
 
 /** \brief Extract the Sharpness of an input vector 
  * 
- * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients from the magnitude spectrum of an audio vector, (e.g. the second half of the array pointed to by *result from xtract_magnitude_spectrum().
+ * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients from the spectrum of an audio vector, (e.g. the first half of the array pointed to by *result from xtract_spectrum().
  * \param N: the number of elements to be considered
  * \param *argv: a pointer to NULL
  * \param *result: the Sharpness of N values from the array pointed to by *data
@@ -322,7 +322,7 @@
 
 /** \brief Extract the Slope of an input vector using a method described by Peeters(2003)
  * 
- * \param *data: a pointer to the first element in an array of floats representing a set of BARK_BANDS bark coefficients
+ * \param *data: a pointer to the first element in an array of floats representing the spectrum of an audio vector, (e.g. the array pointed to by *result from xtract_magnitude_spectrum(), xtract_spectral_peaks() or xtract_spectral_harmonics()).
  * \param N: the number of elements to be considered
  * \param *argv: a pointer to NULL
  * \param *result: the Slope of N values from the array pointed to by *data
@@ -363,7 +363,7 @@
  * 
  * \warning {This function doesn't work properly}
  * 
- * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients from the magnitude spectrum of an audio vector, (e.g. the second half of the array pointed to by *result from xtract_magnitude_spectrum().
+ * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients from the spectrum of an audio vector, (e.g. the first half of the array pointed to by *result from xtract_spectrum().
  * \param N: the number of elements to be considered
  * \param *argv: a pointer to NULL
  * \param *result: the pitch of N values from the array pointed to by *data
--- a/xtract/xtract_vector.h	Wed Jan 10 14:36:43 2007 +0000
+++ b/xtract/xtract_vector.h	Thu Jan 11 16:37:50 2007 +0000
@@ -34,14 +34,14 @@
   * @{
   */
 
-/** \brief Extract normalized (0-1) frequency domain magnitude spectrum from time domain signal 
+/** \brief Extract normalized (0-1) frequency domain spectrum from time domain signal 
  * 
  * \param *data: a pointer to the first element in an array of floats representing an audio vector
  * \param N: the number of array elements to be considered
- * \param *argv: a pointer to a float representing (samplerate / N)
- * \param *result: a pointer to an array of size N containing N/2 magnitude coefficients and N/2 bin frequencies.
+ * \param *argv: a pointer to an array of floats, the first representing (samplerate / N), the second will be cast to an integer and determines the spectrum type (e.g. MAGNITUDE_SPECTRUM, LOG_POWER_SPECTRUM)
+ * \param *result: a pointer to an array of size N containing N/2 magnitude/power/log magnitude/log power coefficients and N/2 bin frequencies.
  */
-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);
 
 /** \brief Extract autocorrelation from time domain signal using FFT based method
  * 
@@ -99,7 +99,7 @@
 int xtract_asdf(const float *data, const int N, const void *argv, float *result);
     
 /** \brief Extract Bark band coefficients based on a method   
- * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients from the magnitude spectrum of an audio vector, (e.g. the second half of the array pointed to by *result from xtract_magnitude_spectrum().
+ * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients from the magnitude spectrum of an audio vector, (e.g. the first half of the array pointed to by *result from xtract_spectrum().
  * \param N: the number of array elements to be considered
  * \param *argv: a pointer to an array of ints representing the limits of each bark band. This can be obtained  by calling xtract_init_bark.
  * \param *result: a pointer to an array containing resultant bark coefficients
@@ -110,10 +110,10 @@
 int xtract_bark_coefficients(const float *data, const int N, const void *argv, float *result);
 
 /** \brief Extract the amplitude and frequency of spectral peaks from a magnitude spectrum
- * \param *data: a pointer to the first element in an array of floats representing N/2 magnitude coefficients from the magnitude spectrum of an audio vector, (e.g. the first half of the array pointed to by *result from xtract_magnitude_spectrum(), or xtract_magnitudes().
- * \param N: the size of the output array (note: the input array can be of size N/2)
+ * \param *data: a pointer to an array of size N containing N/2 magnitude/power/log magnitude/log power coefficients and N/2 bin frequencies. (e.g. the first half of the array pointed to by *result from xtract_spectrum().
+ * \param N: the size of the output array (note: the input array can be of size N/2, i.e. just the magnitudes)
  * \param *argv: a pointer to an array containing the peak threshold as percentage of the magnitude of the maximum peak found, and a float representing (samplerate / N)  
- * \param *result: a pointer to an array of size N containing N/2 magnitude coefficients and N/2 bin frequencies.
+ * \param *result: a pointer to an array of size N containing N/2 magnitude/power/log magnitude/log power coefficients and N/2 bin frequencies.
  *
  */