Example #1
0
void ofxAubioBeat::setup(string method, int buf_s, int hop_s, int samplerate)
{
    ofxAubioBlock::setup(method, buf_s, hop_s, samplerate);
    tempo = new_aubio_tempo((char_t*)method.c_str(),
                            buf_size, hop_size, samplerate);
    aubio_tempo_set_silence(tempo, -40);
    if (tempo) {
        ofLogNotice() << "created ofxAubioBeat(" << method
          << ", " << buf_size
          << ", " << hop_size
          << ", " << samplerate
          << ")";
    }
}
static void *aubiotempo_tilde_new (t_floatarg f)
{
  t_aubiotempo_tilde *x = 
    (t_aubiotempo_tilde *)pd_new(aubiotempo_tilde_class);

  x->threshold = (f < 1e-5) ? 0.1 : (f > 10.) ? 10. : f;
  x->silence = -70.;
  /* should get from block~ size */
  x->bufsize   = 1024;
  x->hopsize   = x->bufsize / 2;

  x->t = new_aubio_tempo (aubio_onset_complex, x->bufsize, x->hopsize, 1);
  aubio_tempo_set_silence(x->t,x->silence);
  aubio_tempo_set_threshold(x->t,x->threshold);
  x->output = (fvec_t *)new_fvec(2,1);
  x->vec = (fvec_t *)new_fvec(x->hopsize,1);

  floatinlet_new (&x->x_obj, &x->threshold);
  x->tempobang = outlet_new (&x->x_obj, &s_bang);
  x->onsetbang = outlet_new (&x->x_obj, &s_bang);
  post(aubiotempo_version);
  return (void *)x;
}