ref: 2293d6a285c02b1fc13c49420cf38f229478157f
parent: 1b7f3692323a1b5356d9a8977e7efb0fc96ed3a1
author: Paul Brossier <piem@piem.org>
date: Fri Jul 22 17:28:15 EDT 2016
examples/: also emit midi note from aubioonset, thanks to topas-rec (closes #62)
--- a/examples/aubioonset.c
+++ b/examples/aubioonset.c
@@ -37,6 +37,8 @@
fvec_zeros(obuf);
if ( is_onset ) {
aubio_wavetable_play ( wavetable );
+ /* send a midi tap (default to C0) out to the midi output */
+ if (usejack) send_noteon(miditap_note, miditap_velo);
} else {
aubio_wavetable_stop ( wavetable );
}
@@ -77,6 +79,9 @@
//aubio_sampler_load (sampler, "/archives/sounds/woodblock.aiff");
examples_common_process((aubio_process_func_t)process_block, process_print);
+
+ // send a last note off
+ send_noteon (miditap_note, 0);
del_aubio_onset (o);
del_aubio_wavetable (wavetable);
--- a/examples/aubiotrack.c
+++ b/examples/aubiotrack.c
@@ -40,18 +40,8 @@
fvec_zeros (obuf);
if ( is_beat && !is_silence ) {
aubio_wavetable_play ( wavetable );
- /* Send tap over midi output */
- /* Is called without jack use so ask for jack use */
- if (usejack)
- {
- /* Note on midi clock: Midi clock looks like it is more suitable here,
- * but it is send 24 times between the detected bpm which is impossible
- * to do since we get here only once per peat.
- * Therefore midinote is used as a good workaround.
- * Reference:
- * http://www.blitter.com/~russtopia/MIDI/~jglatt/tech/midispec/clock.htm */
- send_noteon(0, 0);
- }
+ /* send a midi tap (default to C0) out to the midi output */
+ if (usejack) send_noteon(miditap_note, miditap_velo);
} else {
aubio_wavetable_stop ( wavetable );
}
@@ -93,6 +83,9 @@
//aubio_sampler_load (sampler, "/archives/sounds/woodblock.aiff");
examples_common_process((aubio_process_func_t)process_block,process_print);
+
+ // send a last note off
+ send_noteon (miditap_note, 0);
del_aubio_tempo(tempo);
del_aubio_wavetable (wavetable);
--- a/examples/parse_args.h
+++ b/examples/parse_args.h
@@ -47,6 +47,9 @@
// more general stuff
extern smpl_t silence_threshold;
extern uint_t mix_input;
+// midi tap
+extern smpl_t miditap_note;
+extern smpl_t miditap_velo;
extern uint_t force_overwrite;
--- a/examples/utils.c
+++ b/examples/utils.c
@@ -64,6 +64,9 @@
fvec_t *ibuf;
fvec_t *obuf;
+smpl_t miditap_note = 69.;
+smpl_t miditap_velo = 65.;
+
/* settings */
int blocks = 0;