diff examples/puredata/xtract~.c @ 161:246c203cc733

Add wavelet-based pitch tracker
author Jamie Bullock <jamie@jamiebullock.com>
date Fri, 31 May 2013 22:44:03 +0100
parents baaa9d8b4d10
children
line wrap: on
line diff
--- a/examples/puredata/xtract~.c	Fri May 31 22:43:17 2013 +0100
+++ b/examples/puredata/xtract~.c	Fri May 31 22:44:03 2013 +0100
@@ -72,7 +72,7 @@
     t_int rv = 0;
     double result = 0.0;
 
-    for(n = 0; n < N; ++n) {
+    for(t_int n = 0; n < N; ++n) {
         x->data[n] = (double)in[n];
     }
 
@@ -148,7 +148,7 @@
     t_int n, N, M, f, F, 
           n_args, 
           type;
-    t_float *argv_max;
+    double *argv_max;
     t_symbol *arg1;
     xtract_function_descriptor_t *fd;
     char *p_name, 
@@ -259,7 +259,7 @@
     if(x->is_subframe)
         N = M;
 
-    post("xtract~: window size: %d", N);
+    post("xtract~: assumed window size: %d", N);
 
     /* do init if needed */
     if(x->feature == XTRACT_MFCC){
@@ -271,9 +271,9 @@
         post("xtract~: mfcc: filters = %d", 
 		((xtract_mel_filter *)x->argv)->n_filters);
         mf->filters = 
-            (t_float **)getbytes(mf->n_filters * sizeof(t_float *));
+            (double **)getbytes(mf->n_filters * sizeof(double *));
         for(n = 0; n < mf->n_filters; n++)
-            mf->filters[n] = (float *)getbytes(N * sizeof(float));
+            mf->filters[n] = (double *)getbytes(N * sizeof(double));
                  
         xtract_init_mfcc(N, NYQUIST, XTRACT_EQUAL_GAIN, 80.0f,
                 18000.0f, mf->n_filters, mf->filters);
@@ -288,6 +288,9 @@
         x->argv = x->window;
         x->done_init = 1;
     }
+    else if(x->feature == XTRACT_WAVELET_F0){
+        xtract_init_wavelet_f0_state();
+    }
 
     /* Initialise fft_plan if required */
     if(x->feature == XTRACT_AUTOCORRELATION_FFT ||