[chuck-users] midi clock
Perry R Cook
prc at CS.Princeton.EDU
Thu Apr 20 23:33:47 EDT 2006
In the original MIDI, clock was just a one byte
message that subdivided musical time into either
12ths of 24ths of quarter notes. That, combined
with MIDI start and stop, allowed drum machines to
talk to each other and sequencers, etc. It should
be easy to implement this using our standard MIDI
and event framework:
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
}
}
}
More information about the chuck-users
mailing list