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;
}
Esempio n. 2
0
int main(int argc, char **argv) {
  // change some default params
  buffer_size  = 512;
  hop_size = 256;

  examples_common_init(argc,argv);

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

  pv = new_aubio_pvoc (buffer_size, hop_size);
  fftgrain = new_cvec (buffer_size);
  mfcc = new_aubio_mfcc(buffer_size, n_filters, n_coefs, samplerate);
  mfcc_out = new_fvec(n_coefs);

  examples_common_process((aubio_process_func_t)process_block, process_print);

  del_aubio_pvoc (pv);
  del_cvec (fftgrain);
  del_aubio_mfcc(mfcc);
  del_fvec(mfcc_out);

  examples_common_del();
  return 0;
}
Esempio n. 3
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;
}
Esempio n. 4
0
int main(int argc, char **argv) {

  buffer_size = 2048;

  examples_common_init(argc,argv);

  verbmsg ("using source: %s at %dHz\n", source_uri, samplerate);
  verbmsg ("pitch method: %s, ", pitch_method);
  verbmsg ("pitch unit: %s, ", pitch_unit);
  verbmsg ("buffer_size: %d, ", buffer_size);
  verbmsg ("hop_size: %d, ", hop_size);
  verbmsg ("tolerance: %f\n", pitch_tolerance);

  o = new_aubio_pitch (pitch_method, buffer_size, hop_size, samplerate);
  if (pitch_tolerance != 0.) aubio_pitch_set_tolerance (o, pitch_tolerance);
  if (pitch_unit != NULL) aubio_pitch_set_unit (o, pitch_unit);
  pitch = new_fvec (1);

  wavetable = new_aubio_wavetable (samplerate, hop_size);
  aubio_wavetable_play ( wavetable );

  examples_common_process((aubio_process_func_t)process_block,process_print);

  del_aubio_pitch (o);
  del_aubio_wavetable (wavetable);
  del_fvec (pitch);

  examples_common_del();
  return 0;
}
Esempio n. 5
0
void examples_common_process (aubio_process_func_t process_func,
    aubio_print_func_t print)
{

  uint_t read = 0;
  if (usejack) {

#ifdef HAVE_JACK
    ev.size = 3;
    ev.buffer = malloc (3 * sizeof (jack_midi_data_t));
    ev.time = 0; // send it now
    debug ("Jack activation ...\n");
    aubio_jack_activate (jack_setup, process_func);
    debug ("Processing (Ctrl+C to quit) ...\n");
    pause ();
    aubio_jack_close (jack_setup);
#else /* HAVE_JACK */
    usage (stderr, 1);
    outmsg ("Compiled without jack output, exiting.\n");
#endif /* HAVE_JACK */

  } else {

    uint_t total_read = 0;
    blocks = 0;

    do {
      aubio_source_do (this_source, ibuf, &read);
      process_func (ibuf, obuf);
      // print to console if verbose or no output given
      if (verbose || sink_uri == NULL) {
        print();
      }
      if (this_sink) {
        aubio_sink_do (this_sink, obuf, hop_size);
      }
      blocks++;
      total_read += read;
    } while (read == hop_size);

    verbmsg ("read %.2fs (%d samples in %d blocks of %d) from %s at %dHz\n",
        total_read * 1. / samplerate,
        total_read, blocks, hop_size, source_uri, samplerate);

    del_aubio_source (this_source);
    del_aubio_sink   (this_sink);

  }
}