aboutsummaryrefslogtreecommitdiff
path: root/xtract
diff options
context:
space:
mode:
Diffstat (limited to 'xtract')
-rw-r--r--xtract/libxtract.h17
-rw-r--r--xtract/xtract_macros.h17
-rw-r--r--xtract/xtract_scalar.h18
-rw-r--r--xtract/xtract_vector.h3
4 files changed, 40 insertions, 15 deletions
diff --git a/xtract/libxtract.h b/xtract/libxtract.h
index 51561cd..a78e239 100644
--- a/xtract/libxtract.h
+++ b/xtract/libxtract.h
@@ -112,6 +112,12 @@ enum features_ {
HARMONIC_SPECTRUM
};
+/** \brief Enumeration of feature initialisation functions */
+enum feature_init_ {
+ INIT_MFCC = 100,
+ INIT_BARK
+};
+
/** \brief Enumeration of feature types */
enum feature_types_ {
SCALAR,
@@ -146,14 +152,20 @@ enum spectrum_ {
/** \brief Enumeration of data types*/
typedef enum type_ {
FLOAT,
+ FLOATARRAY,
INT,
MEL_FILTER
} t_type;
/** \brief Enumeration of units*/
typedef enum unit_ {
- HERTZ,
- DBFS
+ /* NONE, ANY */
+ HERTZ = 2,
+ ANY_AMPLITUDE_HERTZ,
+ DBFS,
+ DBFS_HERTZ,
+ PERCENT,
+ SONE
} t_unit;
/** \brief Boolean */
@@ -217,6 +229,7 @@ typedef struct _function_descriptor {
t_bool is_scalar;
+ /* The result.<> entries in descritors.c need to be checked */
union {
struct {
diff --git a/xtract/xtract_macros.h b/xtract/xtract_macros.h
index f3b85f2..19983d3 100644
--- a/xtract/xtract_macros.h
+++ b/xtract/xtract_macros.h
@@ -35,16 +35,29 @@ extern "C" {
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#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 2e-42
#define LOG_LIMIT VERY_SMALL_NUMBER
#define LOG_LIMIT_DB -96
#define DB_SCALE_OFFSET 96
#define VERY_BIG_NUMBER 2e42
-#define SR_LIMIT 192000
+#define SR_UPPER_LIMIT 192000
+#define SR_LOWER_LIMIT 22050
+#define SR_DEFAULT 44100
+#define FUNDAMENTAL_DEFAULT 440
+#define CHECK_nyquist if(!nyquist) nyquist = SR_DEFAULT / N
+#define SR_LIMIT SR_UPPER_LIMIT
+#define FFT_BANDS_MIN 16
+#define FFT_BANDS_MAX 65536
+#define FFT_BANDS_DEF 1024
+#define SPEC_BW_MIN 0.168 /* Minimum spectral bandwidth (= SR_LOWER_LIMIT / \
+ FFT_BANDS_MAX*/
+#define SPEC_BW_MAX 12000 /* SR_UPPER_LIMIT / FFT_BANDS_MIN */
+#define SPEC_BW_DEF 43.066 /* SR_DEFAULT / FFT_BANDS_DEF */
#define BARK_BANDS 26
#define NONE 0
+#define ANY -1
+#define UNKNOWN -2
#define MAXARGS 4
#define MAX_NAME_LENGTH 64
#define MAX_AUTHOR_LENGTH 128
diff --git a/xtract/xtract_scalar.h b/xtract/xtract_scalar.h
index 63aa6cd..c3dbfc7 100644
--- a/xtract/xtract_scalar.h
+++ b/xtract/xtract_scalar.h
@@ -220,7 +220,7 @@ int xtract_zcr(const float *data, const int N, const void *argv, float *result);
*
* \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 *argv: a pointer to an array containing a float representing (samplerate / N ) and a float representing the threshold for rolloff, i.e. the percentile at which the rolloff is determined, expressed as a percentage, and
* \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.
*/
int xtract_rolloff(const float *data, const int N, const void *argv, float *result);
@@ -258,10 +258,10 @@ int xtract_tonality(const float *data, const int N, const void *argv, float *res
/** \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 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
+ * \param *data: a pointer to NULL
+ * \param N:
+ * \param *argv: a pointer to an array containing a float represnting the number of harmonic partials in a spectrum, and a float representing the number of partials in a spectrum
+ * \param *result: the noisiness coefficient as calculated from argv
*/
int xtract_noisiness(const float *data, const int N, const void *argv, float *result);
@@ -285,9 +285,9 @@ int xtract_spectral_inharmonicity(const float *data, const int N, const void *ar
/** \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 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 *data: a pointer to NULL
+ * \param N: not used
+ * \param *argv: a pointer to an array containing a float representing the maximum value in a spectrum, and a float representing the mean value of a spectrum
* \param *result: the spectral crest of N values from the array pointed to by *data
*/
int xtract_crest(const float *data, const int N, const void *argv, float *result);
@@ -306,7 +306,7 @@ int xtract_power(const float *data, const int N, const void *argv, float *result
*
* \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 *argv: a pointer to a float representing the fundamental frequency of the input vector.
* \param *result: the odd/even harmonic ratio of N values from the array pointed to by *data
*/
int xtract_odd_even_ratio(const float *data, const int N, const void *argv, float *result);
diff --git a/xtract/xtract_vector.h b/xtract/xtract_vector.h
index 26a7ff4..4be7e45 100644
--- a/xtract/xtract_vector.h
+++ b/xtract/xtract_vector.h
@@ -112,11 +112,10 @@ int xtract_bark_coefficients(const float *data, const int N, const void *argv, f
/** \brief Extract the amplitude and frequency of spectral peaks from a magnitude spectrum
* \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 *argv: a pointer to an array of floats, the first representing (samplerate / N), the second representing the peak threshold as percentage of the magnitude of the maximum peak found
* \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_peak_spectrum(const float *data, const int N, const void *argv, float *result);
/** \brief Extract the harmonic spectrum of from a of a peak spectrum