aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libxtract.c3
-rw-r--r--src/scalar.c11
-rw-r--r--xtract/libxtract.h8
-rw-r--r--xtract/xtract_macros.h2
-rw-r--r--xtract/xtract_scalar.h15
5 files changed, 30 insertions, 9 deletions
diff --git a/src/libxtract.c b/src/libxtract.c
index afd2581..0595113 100644
--- a/src/libxtract.c
+++ b/src/libxtract.c
@@ -67,8 +67,9 @@ int(*xtract[])(float *, int, void *, float *) = {
xtract_odd_even_ratio,
xtract_sharpness,
xtract_slope,
- xtract_f0,
+ xtract_lowest_match,
xtract_hps,
+ xtract_f0,
/* xtract_vector.h */
xtract_magnitude_spectrum,
xtract_autocorrelation,
diff --git a/src/scalar.c b/src/scalar.c
index c082440..1cc3128 100644
--- a/src/scalar.c
+++ b/src/scalar.c
@@ -23,6 +23,7 @@
#include "xtract/libxtract.h"
#include "math.h"
+#include <stdlib.h>
int xtract_mean(float *data, int N, void *argv, float *result){
@@ -324,7 +325,7 @@ int xtract_slope(float *data, int N, void *argv, float *result){
}
-int xtract_f0(float *data, int N, void *argv, float *result){
+int xtract_lowest_match(float *data, int N, void *argv, float *result){
/* int n, M = N >> 1;
float guess, error, minimum_error = 1000000, f0, freq;
@@ -412,4 +413,10 @@ int xtract_hps(float *data, int N, void *argv, float *result){
free(product);
}
-
+
+
+int xtract_f0(float *data, int N, void *argv, float *result){
+
+ NOT_IMPLEMENTED;
+
+}
diff --git a/xtract/libxtract.h b/xtract/libxtract.h
index 0e4f254..921eb4d 100644
--- a/xtract/libxtract.h
+++ b/xtract/libxtract.h
@@ -29,7 +29,7 @@ extern "C" {
* \file libxtract.h: main header file and API definition
*/
-#define VERSION "0.1"
+#define VERSION "0.11"
#include "xtract_scalar.h"
@@ -38,8 +38,9 @@ extern "C" {
#include "xtract_types.h"
#include "xtract_macros.h"
-#define XTRACT_FEATURES 40
+#define XTRACT_FEATURES 41
#define LOG_LIMIT 10e-10
+#define VERY_BIG_NUMBER 2e10
#define SR_LIMIT 192000
#define BARK_BANDS 26
@@ -71,8 +72,9 @@ enum features_ {
ODD_EVEN_RATIO,
SHARPNESS,
SLOPE,
- F0,
+ LOWEST_MATCH,
HPS,
+ F0,
MAGNITUDE_SPECTRUM,
AUTOCORRELATION,
AUTOCORRELATION_FFT,
diff --git a/xtract/xtract_macros.h b/xtract/xtract_macros.h
index 4aebf59..7cce4c0 100644
--- a/xtract/xtract_macros.h
+++ b/xtract/xtract_macros.h
@@ -29,6 +29,8 @@
extern "C" {
#endif
+#include <stdio.h>
+
#define SQ(a) ((a) * (a))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
diff --git a/xtract/xtract_scalar.h b/xtract/xtract_scalar.h
index 46b4549..6ddea98 100644
--- a/xtract/xtract_scalar.h
+++ b/xtract/xtract_scalar.h
@@ -256,15 +256,15 @@ int xtract_sharpness(float *data, int N, void *argv, float *result);
*/
int xtract_slope(float *data, int N, void *argv, float *result);
-/** \brief Extract the value of the first partial in an input vector
+/** \brief Extract the value of the first partial in an input vector that closely matches a certain 'guess'
*
* \param *data: a pointer to the first element in an array of floats that represents the frequencies of the spectral peaks of an audio vector
* \param N: the number of elements to be considered
- * \param *argv: a pointer to a float value representing the approximate F0
+ * \param *argv: a pointer to a float value representing the guess
* \param *result: the F0 of N values from the array pointed to by *data
*
* This method takes a guess which can come from taking the ZCR of an autocorrelation function, and then finds the spectral peak that most closely matches the gess */
-int xtract_f0(float *data, int N, void *argv, float *result);
+int xtract_lowest_match(float *data, int N, void *argv, float *result);
/** \brief Extract the Pitch of an input vector using Harmonic Product Spectrum (HPS) analysis
*
@@ -275,6 +275,15 @@ int xtract_f0(float *data, int N, void *argv, float *result);
*/
int xtract_hps(float *data, int N, void *argv, float *result);
+/** \brief Extract the fundamental frequency of an input vector
+ *
+ * \param *data: a pointer to the first element in an array of floats representing an audio vector
+ * \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
+ */
+int xtract_f0(float *data, int N, void *argv, float *result);
+
#ifdef __cplusplus
}
#endif