aboutsummaryrefslogtreecommitdiff
path: root/xtract
diff options
context:
space:
mode:
Diffstat (limited to 'xtract')
-rw-r--r--xtract/libxtract.h11
-rw-r--r--xtract/xtract_macros.h7
-rw-r--r--xtract/xtract_scalar.h28
-rw-r--r--xtract/xtract_vector.h8
4 files changed, 40 insertions, 14 deletions
diff --git a/xtract/libxtract.h b/xtract/libxtract.h
index 7670c83..8c0dc40 100644
--- a/xtract/libxtract.h
+++ b/xtract/libxtract.h
@@ -53,13 +53,8 @@ extern "C" {
* @{
*/
-#define XTRACT_FEATURES 45
+#define XTRACT_FEATURES 47
-#define LOG_LIMIT 10e-10
-#define VERY_BIG_NUMBER 2e10
-#define SR_LIMIT 192000
-#define BARK_BANDS 26
-
/** \brief Enumeration of features, elements are used as indixes to an array of pointers to feature extracton functions */
enum features_ {
MEAN,
@@ -89,7 +84,9 @@ enum features_ {
ODD_EVEN_RATIO,
SHARPNESS,
SLOPE,
- LOWEST,
+ LOWEST_VALUE,
+ HIGHEST_VALUE,
+ SUM,
HPS,
F0,
FAILSAFE_F0,
diff --git a/xtract/xtract_macros.h b/xtract/xtract_macros.h
index 3ee97b2..f2a89b7 100644
--- a/xtract/xtract_macros.h
+++ b/xtract/xtract_macros.h
@@ -36,6 +36,13 @@ extern "C" {
#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 VERY_SMALL_NUMBER 1e-20
+#define LOG_LIMIT VERY_SMALL_NUMBER
+#define VERY_BIG_NUMBER 1e20
+#define SR_LIMIT 192000
+#define BARK_BANDS 26
+
+
#ifdef __cplusplus
}
#endif
diff --git a/xtract/xtract_scalar.h b/xtract/xtract_scalar.h
index c4618fa..8d8c446 100644
--- a/xtract/xtract_scalar.h
+++ b/xtract/xtract_scalar.h
@@ -271,15 +271,35 @@ int xtract_sharpness(const float *data, const int N, const void *argv, float *re
*/
int xtract_slope(const float *data, const int N, const void *argv, float *result);
-/** \brief Extract the value of the lowest value in an input vector that between two bounds
+/** \brief Extract the value of the lowest value in an input vector
*
* \param *data: a pointer to the first element in an array of floats
* \param N: the number of elements to be considered
- * \param *argv: a pointer to an array containing a lower and upper bounds for search, where lower < n < upper.
- * \param *result: a pointer to a value representing the lowest non-zero component in *data. If no match is found then -0 is returned.
+ * \param *argv: a pointer to a float representing the lower limit for the search. i.e. (*result > *argv) returns 1.
+ * \param *result: a pointer to a value representing the lowest component in *data that falls above a given threshold.
*
*/
-int xtract_lowest(const float *data, const int N, const void *argv, float *result);
+int xtract_lowest_value(const float *data, const int N, const void *argv, float *result);
+
+/** \brief Extract the value of the highest value in an input vector
+ *
+ * \param *data: a pointer to the first element in an array of floats
+ * \param N: the number of elements to be considered
+ * \param *argv: a pointer to NULL.
+ * \param *result: a pointer to a value representing the highest component in *data.
+ *
+ */
+int xtract_highest_value(const float *data, const int N, const void *argv, float *result);
+
+/** \brief Extract the sum of the values in an input vector
+ *
+ * \param *data: a pointer to the first element in an array of floats
+ * \param N: the number of elements to be considered
+ * \param *argv: a pointer to NULL.
+ * \param *result: a pointer to a value representing the sum of all of the values pointed to by *data.
+ *
+ */
+int xtract_sum(const float *data, const int N, const void *argv, float *result);
/** \brief Extract the Pitch of an input vector using Harmonic Product Spectrum (HPS) analysis
*
diff --git a/xtract/xtract_vector.h b/xtract/xtract_vector.h
index 215c782..92e908a 100644
--- a/xtract/xtract_vector.h
+++ b/xtract/xtract_vector.h
@@ -112,16 +112,18 @@ int xtract_bark_coefficients(const float *data, const int N, const void *argv, f
/** \brief Extract the frequency and amplitude of spectral peaks from a magnitude spectrum
* \param *data: a pointer to the first element in an array of floats representing the magnitude spectrum of an audio vector
* \param N: the number of array elements to be considered
- * \param *argv: a pointer to an array containing peak threshold as percentage below max peak, and sample rate
- * \param *result: a pointer to an array of size N, containing N/2 freqs and N/2 amplitudes, amplitudes are on a decibel scale with dbFS = 0
+ * \param *argv: a pointer to an array containing the peak threshold as percentage of the magnitude of the maximum peak found, and the sample rate in Hz.
+ * \param *result: a pointer to an array of size N, containing N/2 freqs and N/2 amplitudes
+ *
*/
+
int xtract_peaks(const float *data, const int N, const void *argv, float *result);
/** \brief Extract the harmonic spectrum of from a of a peak spectrum
* \param *data: a pointer to the first element in an array of floats representing the peak spectrum of an audio vector (e.g. *result from xtract_peaks). It is expected that the first half of the array pointed to by *data will contain frequencies for each peak considered, and the the second half will contain the respective amplitudes
* \param N: the size of the array pointed to by *data
* \param *argv: a pointer to an array containing the fundamental (f0) of the spectrum, and a threshold (t) where 0<=t<=1.0, and t determines the distance from the nearest harmonic number within which a partial can be considered harmonic.
- * \param *result: a pointer to an array of size N containing N/2 freqs and N/2 amplitudes, amplitudes are on a decibel scale with dbFS = 0
+ * \param *result: a pointer to an array of size N containing N/2 freqs and N/2 amplitudes.
*/
int xtract_harmonics(const float *data, const int N, const void *argv, float *result);