// Jam On It Transmitter // MIDI over OSC low latency jamming system // by Les Hall // // CHANGE THIS STUFF appropriately // // host name and ports "localhost" => string hostname; 8001 => int outPort; // number of the device to open (see: chuck --probe) 0 => int device; // get command line parameters if present if (me.args()) me.arg(0) => hostname; if (me.args() > 1) me.arg(1) => Std.atoi => outPort; if (me.args() > 2) me.arg(2) => Std.atoi => device; // // MIDI stuff // // the midi event MidiIn min; // the message for retrieving data MidiMsg msg; // open the device if( !min.open( device ) ) me.exit(); // print out device that was opened <<< "MIDI device:", min.num(), " -> ", min.name() >>>; // // OSC stuff // // send object OscSend xmit; // aim the transmitter xmit.setHost( hostname, outPort ); // infinite time loop function void send(int x, int y, int z) { // start the message... // the type string ',i' expects a single int argument xmit.startMsg("/JamOnIt/MIDI/", "i,i,i"); // a message is kicked as soon as it is complete // - type string is satisfied and bundles are closed x => xmit.addInt; y => xmit.addInt; z => xmit.addInt; } // // Time loop // // infinite time-loop while( true ) { // wait on the event 'min' min => now; // do for all pending messages while(min.recv(msg) ) { // send the MIDI message send(msg.data1, msg.data2, msg.data3); } }