Esempio n. 1
0
void process_block(fvec_t * ibuf, fvec_t *obuf) {
  aubio_tempo_do (tempo, ibuf, tempo_out);
  is_beat = fvec_get_sample (tempo_out, 0);
  //smpl_t bpm = aubio_tempo_get_bpm(tempo); 
  //uint_t last_beat = aubio_tempo_get_last(tempo);

  aubio_pitch_do (pitch, ibuf, pitch_out);
  smpl_t freq = fvec_get_sample(pitch_out, 0);

  if (silence_threshold != -90.)
    is_silence = aubio_silence_detection(ibuf, silence_threshold);
  fvec_zeros (obuf);
  if ( is_beat && !is_silence ) {
    samples_per_beat = total_frames - my_last_beat;
    my_last_beat = total_frames;

    aubio_wavetable_play ( wavetable );
  } else {
    aubio_wavetable_stop ( wavetable );
  }

  if (mix_input)
    aubio_wavetable_do (wavetable, ibuf, obuf);
  else
    aubio_wavetable_do (wavetable, obuf, obuf);

  rgb_music_iterate(my_last_beat, samples_per_beat, total_frames, freq);

  total_frames += hop_size;
}
Esempio n. 2
0
void process_block(fvec_t * ibuf, fvec_t *obuf) {
  aubio_tempo_do (tempo, ibuf, tempo_out);
  is_beat = fvec_get_sample (tempo_out, 0);
  if (silence_threshold != -90.)
    is_silence = aubio_silence_detection(ibuf, silence_threshold);
  fvec_zeros (obuf);
  if ( is_beat && !is_silence ) {
    aubio_wavetable_play ( wavetable );
  } else {
    aubio_wavetable_stop ( wavetable );
  }
  if (mix_input)
    aubio_wavetable_do (wavetable, ibuf, obuf);
  else
    aubio_wavetable_do (wavetable, obuf, obuf);
}