[chuck-users] how to use MIDI clock in ChucK

Mario Buoninfante mario.buoninfante at gmail.com
Tue Jul 2 17:37:22 EDT 2019


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 <heuermh at 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 at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20190702/2ad3612c/attachment.html>


More information about the chuck-users mailing list