0 => int device; // device # to open (see: chuck --probe) if( me.args() ) me.arg(0) => Std.atoi => device; // get command line MidiIn mdin; // the midi event MidiMsg msg; // message for retrieving data if( !mdin.open( device ) ) me.exit(); // open the device <<< "MIDI device:", mdin.num(), "->", mdin.name() >>>; // print device SinOsc s => dac; // our "synth" 0.0 => s.gain; while( true ) { // infinite time-loop mdin => now; // wait on event 'mdin' while( mdin.recv(msg) ) { // get message(s) <<< msg.data1, msg.data2, msg.data3 >>>; // print message if (msg.data1 == 144) { // if NoteOn msg Std.mtof(msg.data2) => s.freq; // set freq msg.data3 / 127.0 => s.gain; // Note On } else 0.0 => s.gain; // Note Off (stupid version) } }