I am also interested in this. I have tried to make a homebrewed MIDI clock to OSC in Java, but find it hard prevent the ChucK application (that receives my OSC messages) to lose sync if more MIDI messages than the clocks appear in the midi stream. It would be great to be able to receive 0xf8 in ChucK apps - I personally don't need other messages like stop/start or timecode.

/Stefan

On Dec 17, 2007 7:20 PM, Julien Canet <jools@free.fr> wrote:
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 (
https://lists.cs.princeton.edu/pipermail/chuck-users/2006-April/000503.html
) 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,

Julien.
_______________________________________________
chuck-users mailing list
chuck-users@lists.cs.princeton.edu
https://lists.cs.princeton.edu/mailman/listinfo/chuck-users



--
Read Marx and Lenin, it will really turn you loose!