}
/* curlevel is negatif or 1 if silence */
- smpl_t curlevel = aubio_level_detection(ibuf, silence);
+ smpl_t curlevel = aubio_level_detection(ibuf, silence_threshold);
if (fvec_read_sample(onset, 0)) {
/* test for silence */
if (curlevel == 1.) {
aubio_onset_t *o;
aubio_wavetable_t *wavetable;
fvec_t *onset;
+smpl_t is_onset;
+uint_t is_silence = 0.;
void
process_block(fvec_t *ibuf, fvec_t *obuf) {
fvec_zeros(obuf);
aubio_onset_do (o, ibuf, onset);
- if ( fvec_read_sample(onset, 0) ) {
+ if (silence_threshold != -90.)
+ is_silence = aubio_silence_detection(ibuf, silence_threshold);
+ is_onset = fvec_read_sample(onset, 0);
+ if ( is_onset && !is_silence ) {
aubio_wavetable_play ( wavetable );
} else {
aubio_wavetable_stop ( wavetable );
void
process_print (void)
{
- smpl_t onset_found = fvec_read_sample (onset, 0);
- if (onset_found) {
+ if ( is_onset && !is_silence ) {
outmsg ("%f\n", aubio_onset_get_last_s (o) );
}
}
verbmsg ("onset method: %s, ", onset_method);
verbmsg ("buffer_size: %d, ", buffer_size);
verbmsg ("hop_size: %d, ", hop_size);
+ verbmsg ("threshold: %f, ", silence_threshold);
verbmsg ("threshold: %f\n", onset_threshold);
o = new_aubio_onset (onset_method, buffer_size, hop_size, samplerate);
void process_block(fvec_t * ibuf, fvec_t * obuf) {
fvec_zeros (obuf);
- if (aubio_silence_detection(ibuf, silence)==1) {
+ if (aubio_silence_detection(ibuf, silence_threshold)==1) {
if (wassilence==1) issilence = 1;
else issilence = 2;
wassilence=1;
aubio_tempo_t * tempo;
aubio_wavetable_t *wavetable;
fvec_t * tempo_out;
-smpl_t istactus = 0;
-smpl_t isonset = 0;
+smpl_t is_beat = 0;
+smpl_t is_onset = 0;
+uint_t is_silence = 0.;
void process_block(fvec_t * ibuf, fvec_t *obuf) {
aubio_tempo_do (tempo, ibuf, tempo_out);
- istactus = fvec_read_sample (tempo_out, 0);
- isonset = fvec_read_sample (tempo_out, 1);
+ is_beat = fvec_read_sample (tempo_out, 0);
+ is_onset = fvec_read_sample (tempo_out, 1);
+ if (silence_threshold != -90.)
+ is_silence = aubio_silence_detection(ibuf, silence_threshold);
fvec_zeros (obuf);
- if (istactus > 0.) {
+ if ( is_beat && !is_silence ) {
aubio_wavetable_play ( wavetable );
} else {
aubio_wavetable_stop ( wavetable );
}
void process_print (void) {
- if (istactus) {
+ if ( is_beat && !is_silence ) {
outmsg("%f\n", aubio_tempo_get_last_s(tempo) );
}
- //if (isonset && verbose)
+ //if ( is_onset )
// outmsg(" \t \t%f\n",(blocks)*hop_size/(float)samplerate);
}
// tempo stuff
extern char_t * tempo_method;
// more general stuff
-extern smpl_t silence;
+extern smpl_t silence_threshold;
extern uint_t mix_input;
typedef int (*aubio_process_func_t)(fvec_t * input, fvec_t * output);
pitch_tolerance = (smpl_t) atof (optarg);
break;
case 's': /* silence threshold */
- silence = (smpl_t) atof (optarg);
+ silence_threshold = (smpl_t) atof (optarg);
break;
case 'm': /* mix_input flag */
mix_input = 1;
// tempo stuff
char_t * tempo_method = "default";
// more general stuff
-smpl_t silence = -90.;
+smpl_t silence_threshold = -90.;
uint_t mix_input = 0;
//