The tempo in BPM is what drives the TimeSignature class in LicK https://github.com/heuermh/lick/blob/master/lick/duration/TimeSignature.ck, for example a 4/4 kick drum RolandTr808 rolandTr808; TimeSignature.common(120) @=> TimeSignature ts; ts.quarterProvider() @=> QuarterProvider q; spork ~ Loops.loop(rolandTr808.kickE, q).run(); // wait a minute, then change the tempo to 110 BPM 1::minute => now; 110 => ts.tempo; // wait another minute, then decelerate the tempo by 0.8 over the next 30 seconds 1::minute => now; spork ~ ts.decel(0.8, 30::second); etc. If I can calculate the BPM from external clock, then I can adjust the BPM in the TimeSignature class as it is running. michael
On Jul 2, 2019, at 4:37 PM, Mario Buoninfante
wrote: about receiving external clock, I think the goal there is to use the clock to drive the algorithm. I wouldn't try to calculate the BPM if not for just displaying it somewhere.
On Tue, 2 Jul 2019 at 22:17, Michael Heuer
mailto:heuermh@gmail.com> wrote: All, I'm curious how to use MIDI clock effectively in ChucK, in two main use cases:
From a sample-rate-based timer in ChucK, how should I send out MIDI clock?
while (true) { 10::ms => now; // send MIDI clock }
or
TimeSignature.common(120) @=> TimeSignature ts;
while (true) { ts.e => now; // send MIDI clock }
or (this one allows the caller to modify the tempo later)
TimeSignature.common(120) @=> TimeSignature ts; ts.eighthProvider() @=> EighthProvider e;
while (true) { e.evaluate() => now; // send MIDI clock }
From receiving MIDI clock messages from an external source, how should one adjust the BPM in ChucK?
MidiIn min; MidiMsg msg;
TimeSignature.common(120) @=> TimeSignature ts;
while (min.recv(msg)) { // if is clock … { /* new BPM */ => ts.tempo; } }
I would imagine I would want to window over the last n clock messages to average?
Thanks in advance,
michael _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu mailto:chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users https://lists.cs.princeton.edu/mailman/listinfo/chuck-users _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users