}
isonset = aubio_peakpicker_do(parms, onset);
- pitch = aubio_pitchdetection_do (pitchdet,ibuf);
+ aubio_pitchdetection_do (pitchdet, ibuf, pitch_obuf);
+ pitch = fvec_read_sample(pitch_obuf, 0, 0);
if(median){
note_append(note_buffer, pitch);
}
aubio_pvoc_t *pv;
fvec_t *ibuf;
fvec_t *obuf;
+fvec_t *pitch_obuf;
cvec_t *fftgrain;
fvec_t *woodblock;
aubio_onsetdetection_t *o;
if (usepitch) {
pitchdet = new_aubio_pitchdetection (buffer_size * 4,
overlap_size, channels, samplerate, type_pitch, mode_pitch);
- aubio_pitchdetection_set_yinthresh (pitchdet, 0.7);
+ aubio_pitchdetection_set_tolerance (pitchdet, 0.7);
+ pitch_obuf = new_fvec (1, channels);
if (median) {
note_buffer = new_fvec (median, 1);
del_fvec (note_buffer);
del_fvec (note_buffer2);
}
+ del_fvec (pitch_obuf);
}
if (usedoubled) {
del_aubio_onsetdetection (o2);
t_int hopsize;
aubio_pitchdetection_t *o;
fvec_t *vec;
+ fvec_t *pitchvec;
t_outlet *pitch;
} t_aubiopitch_tilde;
t_sample *in = (t_sample *)(w[2]);
int n = (int)(w[3]);
int j;
- smpl_t pitch;
for (j=0;j<n;j++) {
/* write input to datanew */
fvec_write_sample(x->vec, in[j], 0, x->pos);
/*time for fft*/
if (x->pos == x->hopsize-1) {
/* block loop */
- pitch = aubio_pitchdetection(x->o,x->vec);
- outlet_float(x->pitch, pitch);
+ aubio_pitchdetection_do(x->o,x->vec, x->pitchvec);
+ outlet_float(x->pitch, x->pitchvec->data[0][0]);
/* end of block loop */
x->pos = -1; /* so it will be zero next j loop */
}
//FIXME: get the real samplerate
x->o = new_aubio_pitchdetection(x->bufsize,
x->hopsize, 1, 44100., type_pitch, mode_pitch);
- aubio_pitchdetection_set_yinthresh(x->o, 0.7);
+ aubio_pitchdetection_set_tolerance (x->o, 0.7);
x->vec = (fvec_t *)new_fvec(x->hopsize,1);
+ x->pitchvec = (fvec_t *)new_fvec(1,1);
//floatinlet_new (&x->x_obj, &x->threshold);
x->pitch = outlet_new (&x->x_obj, &s_float);
{
del_aubio_pitchdetection(x->o);
del_fvec(x->vec);
+ del_fvec(x->pitchvec);
return 0;
}