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 <heue...@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 > 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