This has two sliders: tempo (independent of tempo track) and midi pitch. It outputs a single short note per beat at the specified tempo.
desc:MIDI Clock Gen JDA
slider1:120<48,200,1>Tempo (BPM)
slider2:60<36,84,1>Midi Pitch
in_pin:none
out_pin:none
@init
i = 0;
thresh = sr;
ttempo = slider1;
samps_per_beat = srate * 60 / ttempo;
note = slider2;
playing = -1;
thresh = samps_per_beat;
@slider
ttempo = slider1;
samps_per_beat = srate * 60 / ttempo;
note = slider2;
( playing >= 0 ) ? (
midisend(0,0x80,playing,72);
playing = -1;
);
playing = -1;
thresh = samps_per_beat;
@sample
i += 1;
(i >= thresh) ? (
i = 0;
playing = note;
midisend(0,0x90,note,72);
) : (
( playing >= 0 && i >= (thresh / 10) ) ? (
playing = -1;
midisend(0,0x80,note,72);
)
);