changeset 5:cac976b2a69d

Changed xtract_f0 to xtract_lowest_match
author Jamie Bullock <jamie@postlude.co.uk>
date Thu, 05 Oct 2006 16:59:51 +0000
parents 46efa5536d04
children 3977eb18153b
files src/libxtract.c src/scalar.c xtract/libxtract.h xtract/xtract_macros.h xtract/xtract_scalar.h
diffstat 5 files changed, 30 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/libxtract.c	Thu Oct 05 16:48:38 2006 +0000
+++ b/src/libxtract.c	Thu Oct 05 16:59:51 2006 +0000
@@ -67,8 +67,9 @@
     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,
--- a/src/scalar.c	Thu Oct 05 16:48:38 2006 +0000
+++ b/src/scalar.c	Thu Oct 05 16:59:51 2006 +0000
@@ -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_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 @@
     free(product);
     
 }
-    
+
+
+int xtract_f0(float *data, int N, void *argv, float *result){
+
+   NOT_IMPLEMENTED;
+   
+}
--- a/xtract/libxtract.h	Thu Oct 05 16:48:38 2006 +0000
+++ b/xtract/libxtract.h	Thu Oct 05 16:59:51 2006 +0000
@@ -29,7 +29,7 @@
  * \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 @@
 #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 @@
     ODD_EVEN_RATIO,
     SHARPNESS,
     SLOPE,
-    F0,
+    LOWEST_MATCH,
     HPS,
+	F0,
     MAGNITUDE_SPECTRUM,
     AUTOCORRELATION,
     AUTOCORRELATION_FFT,
--- a/xtract/xtract_macros.h	Thu Oct 05 16:48:38 2006 +0000
+++ b/xtract/xtract_macros.h	Thu Oct 05 16:59:51 2006 +0000
@@ -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))
--- a/xtract/xtract_scalar.h	Thu Oct 05 16:48:38 2006 +0000
+++ b/xtract/xtract_scalar.h	Thu Oct 05 16:59:51 2006 +0000
@@ -256,15 +256,15 @@
  */
 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_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