int main(int argc, char **argv) {
  // override general settings from utils.c
  buffer_size = 1024;
  hop_size = 512;

  examples_common_init(argc,argv);

  verbmsg ("using source: %s at %dHz\n", source_uri, samplerate);

  verbmsg ("tempo method: %s, ", tempo_method);
  verbmsg ("buffer_size: %d, ", buffer_size);
  verbmsg ("hop_size: %d, ", hop_size);
  verbmsg ("threshold: %f\n", onset_threshold);

  tempo_out = new_fvec(2);
  tempo = new_aubio_tempo(tempo_method, buffer_size, hop_size, samplerate);
  // set silence threshold very low to output beats even during silence
  // aubio_tempo_set_silence(tempo, -1000.);
  if (onset_threshold != 0.) aubio_tempo_set_threshold (tempo, onset_threshold);

  wavetable = new_aubio_wavetable (samplerate, hop_size);
  aubio_wavetable_set_freq ( wavetable, 2450.);
  //aubio_sampler_load (sampler, "/archives/sounds/woodblock.aiff");

  examples_common_process((aubio_process_func_t)process_block,process_print);

  del_aubio_tempo(tempo);
  del_aubio_wavetable (wavetable);
  del_fvec(tempo_out);

  examples_common_del();
  return 0;
}
Example #2
0
int main(int argc, char **argv) {
  // override general settings from utils.c
  buffer_size = 1024;
  hop_size = 512;

  rgb_music_init();

  examples_common_init(argc,argv);

  verbmsg ("using source: %s at %dHz\n", source_uri, samplerate);

  verbmsg ("tempo method: %s, ", tempo_method);
  verbmsg ("buffer_size: %d, ", buffer_size);
  verbmsg ("hop_size: %d, ", hop_size);
  verbmsg ("threshold: %f\n", onset_threshold);

  tempo_out = new_fvec(2);
  tempo = new_aubio_tempo(tempo_method, buffer_size, hop_size, samplerate);
  if (onset_threshold != 0.) aubio_tempo_set_threshold (tempo, onset_threshold);

  pitch = new_aubio_pitch (pitch_method, buffer_size, hop_size, samplerate);
  if (pitch_tolerance != 0.)
    aubio_pitch_set_tolerance (pitch, pitch_tolerance);
  if (silence_threshold != -90.)
    aubio_pitch_set_silence (pitch, silence_threshold);
  if (pitch_unit != NULL)
    aubio_pitch_set_unit (pitch, pitch_unit);

  pitch_out = new_fvec (1);



  wavetable = new_aubio_wavetable (samplerate, hop_size);
  aubio_wavetable_set_freq ( wavetable, 2450.);
  //aubio_sampler_load (sampler, "/archives/sounds/woodblock.aiff");

  examples_common_process((aubio_process_func_t)process_block,process_print);

  del_aubio_tempo(tempo);
  del_aubio_wavetable (wavetable);
  del_fvec(tempo_out);

  del_aubio_pitch (pitch);
  del_fvec (pitch_out);

  examples_common_del();
  return 0;
}
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;
}