[chuck-users] chuck and midi clock (again), ignoreTypes() method

Julien Canet jools at free.fr
Mon Dec 17 13:20:12 EST 2007

Dear All,

I am learning chuck and I've made some scripts for the monome 40h
interface (if someone wants I can post them).
I really need to sync my script with another software, using MIDI.
I saw on the users mailing list (
) that midi sync wasn't possible. I didn't really understood why at
first, because I thought we just have to make a midi input handler
that waits for MIDI clock messages, just like the example in the
message :

0 => int device; // number of the device to open (see: chuck --probe)
MidiIn min;     // the midi event
MidiMsg msg;    // the message for retrieving data
if( !min.open( device ) ) me.exit();    // open the device

spork ~ handleMIDI();

fun void handleMIDI()

   while (1)     {
        min => now;                 // wait on the event 'min'
        while( min.recv(msg) )          // get the message(s)
         if (msg.data1 == 248)   {	// MIDI Clock
 	    // Do clocky stuff, count to 24, determine delta-now, whatever

So I wrote a little loop waiting for midi clock message, similar to
the script above.
I never received midi clock messages... (I am sure they are sent using
a MIDI monitor).
I read on chuck forum that MIDI clock messages were not parsed.

So I had a quick look into Chuck source code and try to found why. I
said quick look because I do not understand the whole code to 100%,
I've just tried to find more about these MIDI clock messages.
I saw that in the midiInputCallback, the midi time code and tick
messages (and some other midi messages) are ignored depending on some
RtMidiInData flags : the ignoreFlags, initialized to true (ignoreFlags
set to 7 in fact) in the constructor.

If these flags are true, the size of the message is set to 0 and it is ignored.

I saw that there is a method called RTMidiIn::ignoreTypes that can
changes these flags.

But my BIG question : how to access this ignoreTypes method in chuck language?

I recompiled chuck with ignoreFlags initialized to 0. And now I received them...

So what is the problem with the midi clock messages? Why disabling them?

Can the end-user re enable them without recompiling?

Thanks and congratulations for chuck, this is really wonderful,

Best regards,


More information about the chuck-users mailing list