After days of hard work, templating hell to manage all those odd callbacks, I could make this basic patch work:

# Metro ----> NoteOut ----> Midi
m  = Metro(120)
m.1 => 1.n
n = NoteOut(note:60 length:200)
n.1 => 1.midi
midi = Midi()

It’s just making ‘ping ping ping’, but at least it’s talking to the outside world.

The only problem is that it’s not really steady. I will have to find a way to give a higher priority to my process so it doesn’t get disturbed.

Finally, I am quite happy. My objects are easy to define, have good introspection capabilities and it seems stable enough. Here is a small example of the commandes out can execute illustrating the introspection capabilities :

> no.bang    # output a note
> n.set_note(34)   # change note
> Midi.outputs  # list midi outputs
> n # get info on object 'n'

Now it’s 3am, time to go to sleep and try to be nice with the kids tomorrow…

[edit]

I found how to change the main thread’s priority and it’s now damn steady !

threadSync

Partition view of ‘rubato’ threads.

Clic to listen..

The line on the top corresponds to a normal priority (31), the second to a priority of 47. To do the test, I launched rubyk with the patch above, started recording midi and opened a bunch of applications (Mail, Safari, iTunes, Quicktime, etc).