#include <m_pd.h>
#include <aubio.h>
+#include <string.h>
char aubiopitch_version[] = "aubiopitch~ version 0.1";
}
//static void *aubiopitch_tilde_new (t_floatarg f)
-static void *aubiopitch_tilde_new (void)
+static void *aubiopitch_tilde_new (t_symbol * s)
{
t_aubiopitch_tilde *x =
(t_aubiopitch_tilde *)pd_new(aubiopitch_tilde_class);
x->bufsize = 2048;
x->hopsize = x->bufsize / 2;
+ if (strcmp(s->s_name,"mcomb") == 0)
+ type_pitch = aubio_pitch_mcomb;
+ else if (strcmp(s->s_name,"yinfft") == 0)
+ type_pitch = aubio_pitch_yin;
+ else if (strcmp(s->s_name,"yin") == 0)
+ type_pitch = aubio_pitch_yin;
+ else if (strcmp(s->s_name,"schmitt") == 0)
+ type_pitch = aubio_pitch_schmitt;
+ else if (strcmp(s->s_name,"fcomb") == 0)
+ type_pitch = aubio_pitch_fcomb;
+ else {
+ post("unknown pitch type, using default.\n");
+ }
+
//FIXME: get the real samplerate
- x->o = new_aubio_pitchdetection(x->bufsize*4,
+ x->o = new_aubio_pitchdetection(x->bufsize,
x->hopsize, 1, 44100., type_pitch, mode_pitch);
aubio_pitchdetection_set_yinthresh(x->o, 0.7);
x->vec = (fvec_t *)new_fvec(x->hopsize,1);
(t_newmethod)aubiopitch_tilde_new,
(t_method)aubiopitch_tilde_del,
sizeof (t_aubiopitch_tilde),
- CLASS_DEFAULT, A_DEFFLOAT, 0);
+ CLASS_DEFAULT, A_DEFSYMBOL, 0);
class_addmethod(aubiopitch_tilde_class,
(t_method)aubiopitch_tilde_dsp,
gensym("dsp"), 0);