aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamie Bullock <jamie@postlude.co.uk>2011-03-30 10:51:39 +0000
committerJamie Bullock <jamie@postlude.co.uk>2011-03-30 10:51:39 +0000
commitd88ff54ee9be978bbdb44cedacb9b3df598b1017 (patch)
treecf80ee4d0959024fc598aba8741e1b592f7e6147
parentd43418e0293c2f1f9954e193a9dcc5b82f5ce0c3 (diff)
downloadLibXtract-d88ff54ee9be978bbdb44cedacb9b3df598b1017.tar.gz
LibXtract-d88ff54ee9be978bbdb44cedacb9b3df598b1017.tar.bz2
LibXtract-d88ff54ee9be978bbdb44cedacb9b3df598b1017.zip
- reimplemented xtract_spectral_variance() xtract_spectral_skewness() and xtract_spectral_kurtosis() using correct maths
- removed xtract_spectral_average_deviation()
-rw-r--r--Makefile.am2
-rw-r--r--configure.in64
-rw-r--r--doc/Makefile.am2
-rw-r--r--src/descriptors.c21
-rw-r--r--src/libxtract.c2
-rw-r--r--src/scalar.c36
-rw-r--r--xtract/libxtract.h4
-rw-r--r--xtract/xtract_scalar.h3
8 files changed, 63 insertions, 71 deletions
diff --git a/Makefile.am b/Makefile.am
index 6f72456..62db9c2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -11,4 +11,4 @@ pkgconfig_DATA = libxtract.pc
ACLOCAL_AMFLAGS = -I m4
-EXTRA_DIST = bootstrap autogen.sh README TODO
+EXTRA_DIST = examples/MSP bootstrap autogen.sh README TODO
diff --git a/configure.in b/configure.in
index 8982f74..56cbccb 100644
--- a/configure.in
+++ b/configure.in
@@ -4,18 +4,20 @@ m4_define(libxtract_major_version, 0)
# Increment for feature additions and enhancements
m4_define(libxtract_minor_version, 6)
# Increment for fixes
-m4_define(libxtract_fix_version, 1)
+m4_define(libxtract_fix_version, 4)
# Development status
m4_define(libIntegra_dev_status, [beta])
m4_define(libxtract_version, libxtract_major_version.libxtract_minor_version.libxtract_fix_version)
-
+
PACKAGE=libxtract
-AC_INIT(libxtract, libxtract_version, libxtract-devel@lists.sourceforge.net)
+AC_INIT([libxtract], [libxtract_version], [libxtract-devel@lists.sourceforge.net])
AC_DEFINE(LIBXTRACT_VERSION, libxtract_version, [LibXtract Version])
-AM_INIT_AUTOMAKE($PACKAGE, $LIBXTRACT_VERSION)
+dnl AM_INIT_AUTOMAKE($PACKAGE, $LIBXTRACT_VERSION)
+AM_INIT_AUTOMAKE(1.6)
AM_CONFIG_HEADER(config.h)
+AC_CONFIG_MACRO_DIR([m4])
AC_PROG_CC
AC_PROG_LIBTOOL
AC_PROG_INSTALL
@@ -240,57 +242,57 @@ dnl pd_ldflags="$PD_LDFLAGS -L/usr/local/lib -ldl"
if test -z "$GCC"; then
case $host in
*-*-irix*)
- dnl If we're on IRIX, we wanna use cc even if gcc
- dnl is there (unless the user has overriden us)...
- if test -z "$CC"; then
- CC=cc
- fi
+ dnl If we're on IRIX, we wanna use cc even if gcc
+ dnl is there (unless the user has overriden us)...
+ if test -z "$CC"; then
+ CC=cc
+ fi
;;
sparc-sun-solaris*)
- PD_CFLAGS="-xO4 -fast -w -fsimple -native -xcg92"
+ PD_CFLAGS="-xO4 -fast -w -fsimple -native -xcg92"
;;
*)
- PD_CFLAGS="-O"
+ PD_CFLAGS="-O"
;;
esac
else
case $host in
*86-*-linux*)
- 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
+ PD_CFLAGS="$PD_CFLAGS -DUNIX -Wall -Wimplicit -Wunused"
+ PD_LDFLAGS="$PD_LDFLAGS -shared"
+ dnl we could test for bad glibc here, but don't
+ PD_SUFFIX=pd_linux
;;
powerpc-*-linux*)
- PD_CFLAGS="$PD_CFLAGS -DUNIX -Wall -Wimplicit -Wunused -Wmissing-prototypes"
- PD_LDFLAGS="$PD_LDFLAGS -shared"
- PD_SUFFIX=pd_linux
+ PD_CFLAGS="$PD_CFLAGS -DUNIX -Wall -Wimplicit -Wunused -Wmissing-prototypes"
+ PD_LDFLAGS="$PD_LDFLAGS -shared"
+ PD_SUFFIX=pd_linux
;;
*-*-linux*)
- PD_CFLAGS="$PD_CFLAGS -DUNIX -Wall -Wimplicit -Wunused -Wmissing-prototypes -fPIC"
- PD_LDFLAGS="$PD_LDFLAGS -shared -export_dynamic"
- PD_SUFFIX=pd_linux
+ PD_CFLAGS="$PD_CFLAGS -DUNIX -Wall -Wimplicit -Wunused -Wmissing-prototypes -fPIC"
+ PD_LDFLAGS="$PD_LDFLAGS -shared -export_dynamic"
+ PD_SUFFIX=pd_linux
;;
sparc-sun-*)
- echo "YOU HAVE A SPARC STATION, not setting any flags, not supported yet"
+ echo "YOU HAVE A SPARC STATION, not setting any flags, not supported yet"
;;
*86-*-darwin*)
- PD_CFLAGS="$PD_CFLAGS -DUNIX -Wall -Wimplicit -Wunused -Wmissing-prototypes"
- PD_LDFLAGS="$PD_LDFLAGS -dynamiclib -mmacosx-version-min=10.3 -undefined dynamic_lookup -single_module"
- PD_SUFFIX=pd_darwin
+ PD_CFLAGS="$PD_CFLAGS -DUNIX -Wall -Wimplicit -Wunused -Wmissing-prototypes"
+ PD_LDFLAGS="$PD_LDFLAGS -dynamiclib -mmacosx-version-min=10.3 -undefined dynamic_lookup -single_module"
+ PD_SUFFIX=pd_darwin
;;
*-*-darwin*)
- PD_CFLAGS="$PD_CFLAGS -DUNIX -Wall -Wimplicit -Wunused -Wmissing-prototypes"
- PD_LDFLAGS="$PD_LDFLAGS -bundle -arch ppc -undefined suppress -flat_namespace"
- PD_SUFFIX=pd_darwin
+ PD_CFLAGS="$PD_CFLAGS -DUNIX -Wall -Wimplicit -Wunused -Wmissing-prototypes"
+ PD_LDFLAGS="$PD_LDFLAGS -bundle -arch ppc -undefined suppress -flat_namespace"
+ PD_SUFFIX=pd_darwin
;;
*)
dnl assume unix
- PD_CFLAGS="$PD_CFLAGS -DUNIX -Wall -Wimplicit -Wunused -Wmissing-prototypes -O1"
- PD_LDFLAGS="$PD_LDFLAGS -shared"
- PD_SUFFIX=pd_linux
+ PD_CFLAGS="$PD_CFLAGS -DUNIX -Wall -Wimplicit -Wunused -Wmissing-prototypes -O1"
+ PD_LDFLAGS="$PD_LDFLAGS -shared"
+ PD_SUFFIX=pd_linux
;;
esac
fi
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 6eb4e45..e95cb38 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -6,8 +6,6 @@ CLEANFILES=doxygen-build.stamp
DOX=documentation.doxygen
-EXTRA_DIST=
-
INSTIMAGES=html/doxygen.png
DOC_STAMPS=html-build.stamp
diff --git a/src/descriptors.c b/src/descriptors.c
index 444256d..892a899 100644
--- a/src/descriptors.c
+++ b/src/descriptors.c
@@ -62,7 +62,7 @@ xtract_function_descriptor_t *xtract_make_descriptors(void){
case XTRACT_DIFFERENCE_VECTOR:
case XTRACT_AVERAGE_DEVIATION:
case XTRACT_SPECTRAL_STANDARD_DEVIATION:
- case XTRACT_SPECTRAL_AVERAGE_DEVIATION:
+ /* case XTRACT_SPECTRAL_AVERAGE_DEVIATION: */
case XTRACT_LOWEST_VALUE:
case XTRACT_TONALITY:
case XTRACT_MFCC:
@@ -206,9 +206,9 @@ xtract_function_descriptor_t *xtract_make_descriptors(void){
case XTRACT_SPECTRAL_STANDARD_DEVIATION:
*argv_donor = XTRACT_SPECTRAL_VARIANCE;
break;
- case XTRACT_SPECTRAL_AVERAGE_DEVIATION:
+ /* case XTRACT_SPECTRAL_AVERAGE_DEVIATION:
*argv_donor = XTRACT_SPECTRAL_MEAN;
- break;
+ break; */
case XTRACT_SPECTRAL_INHARMONICITY:
*argv_donor = XTRACT_FAILSAFE_F0;
break;
@@ -300,7 +300,7 @@ xtract_function_descriptor_t *xtract_make_descriptors(void){
case XTRACT_SPECTRAL_MEAN:
case XTRACT_SPECTRAL_VARIANCE:
case XTRACT_SPECTRAL_STANDARD_DEVIATION:
- case XTRACT_SPECTRAL_AVERAGE_DEVIATION:
+ /* case XTRACT_SPECTRAL_AVERAGE_DEVIATION: */
case XTRACT_SPECTRAL_SKEWNESS:
case XTRACT_SPECTRAL_KURTOSIS:
case XTRACT_SPECTRAL_CENTROID:
@@ -432,7 +432,7 @@ xtract_function_descriptor_t *xtract_make_descriptors(void){
case XTRACT_SPECTRAL_MEAN:
case XTRACT_SPECTRAL_VARIANCE:
case XTRACT_SPECTRAL_STANDARD_DEVIATION:
- case XTRACT_SPECTRAL_AVERAGE_DEVIATION:
+ /* case XTRACT_SPECTRAL_AVERAGE_DEVIATION: */
case XTRACT_SPECTRAL_SKEWNESS:
case XTRACT_SPECTRAL_KURTOSIS:
case XTRACT_SPECTRAL_CENTROID:
@@ -530,7 +530,7 @@ xtract_function_descriptor_t *xtract_make_descriptors(void){
"Extract the standard deviation of an audio spectrum");
strcpy(author, "");
break;
- case XTRACT_SPECTRAL_AVERAGE_DEVIATION:
+ /* case XTRACT_SPECTRAL_AVERAGE_DEVIATION:
strcpy(name, "spectral_average_deviation");
strcpy(p_name, "Spectral Average Deviation");
strcpy(desc,
@@ -539,6 +539,7 @@ xtract_function_descriptor_t *xtract_make_descriptors(void){
"Extract the average deviation of an audio spectrum");
strcpy(author, "");
break;
+ */
case XTRACT_ROLLOFF:
strcpy(name, "rolloff");
strcpy(p_name, "Spectral Rolloff");
@@ -963,7 +964,7 @@ xtract_function_descriptor_t *xtract_make_descriptors(void){
case XTRACT_AVERAGE_DEVIATION:
case XTRACT_SPECTRAL_VARIANCE:
case XTRACT_SPECTRAL_STANDARD_DEVIATION:
- case XTRACT_SPECTRAL_AVERAGE_DEVIATION:
+ /* case XTRACT_SPECTRAL_AVERAGE_DEVIATION: */
case XTRACT_SPECTRAL_INHARMONICITY:
case XTRACT_LOWEST_VALUE:
case XTRACT_F0:
@@ -1059,7 +1060,7 @@ xtract_function_descriptor_t *xtract_make_descriptors(void){
case XTRACT_SPECTRAL_MEAN:
case XTRACT_SPECTRAL_VARIANCE:
case XTRACT_SPECTRAL_STANDARD_DEVIATION:
- case XTRACT_SPECTRAL_AVERAGE_DEVIATION:
+ /* case XTRACT_SPECTRAL_AVERAGE_DEVIATION: */
case XTRACT_SPECTRAL_SKEWNESS:
case XTRACT_SPECTRAL_KURTOSIS:
case XTRACT_SPECTRAL_CENTROID:
@@ -1135,7 +1136,7 @@ xtract_function_descriptor_t *xtract_make_descriptors(void){
case XTRACT_SPECTRAL_MEAN:
case XTRACT_SPECTRAL_VARIANCE:
case XTRACT_SPECTRAL_STANDARD_DEVIATION:
- case XTRACT_SPECTRAL_AVERAGE_DEVIATION:
+ /* case XTRACT_SPECTRAL_AVERAGE_DEVIATION: */
case XTRACT_SPECTRAL_SKEWNESS:
case XTRACT_SPECTRAL_KURTOSIS:
case XTRACT_SPECTRAL_CENTROID:
@@ -1227,7 +1228,7 @@ xtract_function_descriptor_t *xtract_make_descriptors(void){
case XTRACT_SPECTRAL_MEAN:
case XTRACT_SPECTRAL_VARIANCE:
case XTRACT_SPECTRAL_STANDARD_DEVIATION:
- case XTRACT_SPECTRAL_AVERAGE_DEVIATION:
+ /* case XTRACT_SPECTRAL_AVERAGE_DEVIATION: */
case XTRACT_SPECTRAL_CENTROID:
case XTRACT_SPREAD:
case XTRACT_F0:
diff --git a/src/libxtract.c b/src/libxtract.c
index 0215add..80a710e 100644
--- a/src/libxtract.c
+++ b/src/libxtract.c
@@ -27,7 +27,7 @@ int(*xtract[])(const float *, const int, const void *, float *) = {
xtract_mean,
xtract_variance,
xtract_standard_deviation,
- xtract_average_deviation,
+ /* xtract_average_deviation, */
xtract_skewness,
xtract_kurtosis,
xtract_spectral_mean,
diff --git a/src/scalar.c b/src/scalar.c
index de1ac03..72422fb 100644
--- a/src/scalar.c
+++ b/src/scalar.c
@@ -186,11 +186,11 @@ int xtract_spectral_variance(const float *data, const int N, const void *argv, f
*result = 0.f;
while(m--){
- A += amps[m];
- *result += powf((freqs[m] - *(float *)argv) * amps[m], 2);
+ A += amps[m];
+ *result += powf(freqs[m] - ((float *)argv)[0], 2) * amps[m];
}
- *result = *result / (A /*- 1*/);
+ *result = *result / A;
return XTRACT_SUCCESS;
}
@@ -202,7 +202,7 @@ int xtract_spectral_standard_deviation(const float *data, const int N, const voi
return XTRACT_SUCCESS;
}
-int xtract_spectral_average_deviation(const float *data, const int N, const void *argv, float *result){
+/*int xtract_spectral_average_deviation(const float *data, const int N, const void *argv, float *result){
int m;
float A = 0.f;
@@ -216,19 +216,18 @@ int xtract_spectral_average_deviation(const float *data, const int N, const void
*result = 0.f;
while(m--){
- A += amps[m];
- *result += fabsf((amps[m] * freqs[m]) - *(float *)argv);
+ A += amps[m];
+ *result += fabsf((amps[m] * freqs[m]) - *(float *)argv);
}
*result /= A;
return XTRACT_SUCCESS;
-}
+}*/
int xtract_spectral_skewness(const float *data, const int N, const void *argv, float *result){
int m;
- float temp, A = 0.f;
const float *freqs, *amps;
m = N >> 1;
@@ -238,14 +237,10 @@ int xtract_spectral_skewness(const float *data, const int N, const void *argv,
*result = 0.f;
- while(m--){
- A += amps[m];
- temp = ((amps[m] * freqs[m]) -
- ((float *)argv)[0]) / ((float *)argv)[1];
- *result += powf(temp, 3);
- }
+ while(m--)
+ *result += powf(freqs[m] - ((float *)argv)[0], 3) * amps[m];
- *result /= A;
+ *result /= powf(((float *)argv)[1], 3);
return XTRACT_SUCCESS;
}
@@ -253,7 +248,6 @@ int xtract_spectral_skewness(const float *data, const int N, const void *argv,
int xtract_spectral_kurtosis(const float *data, const int N, const void *argv, float *result){
int m;
- float temp, A = 0.f;
const float *freqs, *amps;
m = N >> 1;
@@ -263,14 +257,10 @@ int xtract_spectral_kurtosis(const float *data, const int N, const void *argv,
*result = 0.f;
- while(m--){
- A += amps[m];
- temp = ((amps[m] * freqs[m]) -
- ((float *)argv)[0]) / ((float *)argv)[1];
- *result += powf(temp, 4);
- }
+ while(m--)
+ *result += powf(freqs[m] - ((float *)argv)[0], 4) * amps[m];
- *result /= A;
+ *result /= powf(((float *)argv)[1], 4);
*result -= 3.0f;
return XTRACT_SUCCESS;
diff --git a/xtract/libxtract.h b/xtract/libxtract.h
index d0ece81..181ae26 100644
--- a/xtract/libxtract.h
+++ b/xtract/libxtract.h
@@ -68,7 +68,7 @@ extern "C" {
* @{
*/
-#define XTRACT_FEATURES 60
+#define XTRACT_FEATURES 59
/** \brief Enumeration of features, elements are used as indixes to an array of pointers to feature extracton functions */
enum xtract_features_ {
@@ -81,7 +81,7 @@ enum xtract_features_ {
XTRACT_SPECTRAL_MEAN,
XTRACT_SPECTRAL_VARIANCE,
XTRACT_SPECTRAL_STANDARD_DEVIATION,
- XTRACT_SPECTRAL_AVERAGE_DEVIATION,
+ /*XTRACT_SPECTRAL_AVERAGE_DEVIATION, */
XTRACT_SPECTRAL_SKEWNESS,
XTRACT_SPECTRAL_KURTOSIS,
XTRACT_SPECTRAL_CENTROID,
diff --git a/xtract/xtract_scalar.h b/xtract/xtract_scalar.h
index fdfb42a..96834a0 100644
--- a/xtract/xtract_scalar.h
+++ b/xtract/xtract_scalar.h
@@ -71,7 +71,8 @@ int xtract_standard_deviation(const float *data, const int N, const void *argv,
* \param *argv: a pointer to a float representing the mean of the input vector
* \param *result: the average deviation of N values from the array pointed to by *data
*/
-int xtract_average_deviation(const float *data, const int N, const void *argv, float *result);
+/*int xtract_average_deviation(const float *data, const int N, const void *argv, float *result);
+ */
/** \brief Extract the skewness of an input vector
*