// Jam On It Dummy 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; // // 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 // int bits[16]; Math.rand2f(0, (1<<16)-1) $ int => int count; <<>>; // infinite time-loop while( true ) { // wait on the event 'min' second/4.0 => now; count++; for (int i; i<8; i++) (count>>i)&1 => bits[i]; (bits[0] & bits[3] ^ bits[5] & bits[7]) => int note; (bits[1] & bits[2] ^ bits[6] & bits[12]) << 1 +=> note; (bits[0] & bits[5] ^ bits[9] & bits[14]) << 2 +=> note; (bits[2] & bits[4] ^ bits[6] & bits[11]) << 3 +=> note; // send the MIDI message send(0x00B0, 0x0000, 60 + note ); // flute if ((count & 0x0000) == 0) // every so many notes { send(0x00B1, 0x0000, 64 + 2*note ); // loopy drone } }