diff src/scalar.c @ 161:246c203cc733

Add wavelet-based pitch tracker
author Jamie Bullock <jamie@jamiebullock.com>
date Fri, 31 May 2013 22:44:03 +0100
parents 71870680f7c1
children 5c20a9a34f0c
line wrap: on
line diff
--- a/src/scalar.c	Fri May 31 22:43:17 2013 +0100
+++ b/src/scalar.c	Fri May 31 22:44:03 2013 +0100
@@ -28,9 +28,12 @@
 #include <stdio.h>
 #include <math.h>
 
-#include "../xtract/libxtract.h"
-#include "../xtract/xtract_helper.h"
+#include "dywapitchtrack/dywapitchtrack.h"
+
+#include "xtract/libxtract.h"
+#include "xtract/xtract_helper.h"
 #include "xtract_macros_private.h"
+#include "xtract_globals_private.h"
 
 int xtract_mean(const double *data, const int N, const void *argv, double *result)
 {
@@ -953,7 +956,6 @@
 
     if(return_code == XTRACT_NO_RESULT)
     {
-
         sr = *(double *)argv;
         if(sr == 0)
             sr = 44100.0;
@@ -975,3 +977,18 @@
 
 }
 
+int xtract_wavelet_f0(const double *data, const int N, const void *argv, double *result)
+{
+    double sr = *(double *)argv;
+
+    *result = dywapitch_computepitch(&wavelet_f0_state, data, 0, N);
+
+    if (*result == 0.0)
+    {
+        return XTRACT_NO_RESULT;
+    }
+
+    return XTRACT_SUCCESS;
+}
+
+