// bassline // the device number to open 0 => int deviceNum; // instantiate a HidIn object Hid hi; // structure to hold HID messages HidMsg msg; // open keyboard if( !hi.openKeyboard( deviceNum ) ) me.exit(); // successful! print name of device <<< "keyboard '", hi.name(), "' ready" >>>; SawOsc osc[2]; ADSR env; for( int i; i < osc.size(); i++ ) { osc[i]=> ResonZ filter => NRev r => env => dac; env.set( 100::ms, 200::ms, .7, 100::ms ); 0.2 => filter.Q; 0.3 => r.mix; } 0 => osc[0].gain; 0 => osc[1].gain; [56, 68, 57, 72] @=> int notes[]; while( true ) { // wait on event hi => now; // get one or more messages while( hi.recv( msg ) ) { // check for action type if( msg.isButtonDown() && msg.which == 11) { // print <<< "down: h" >>>; env.keyOn(); 0.1 => osc[0].gain; 0.08 => osc[1].gain; Std.mtof(57) => osc[0].freq; Std.mtof(60) => osc[1].freq; //4::second => now; 20::ms => now; } else if( msg.isButtonDown() && msg.which == 13) { // print <<< "down: j" >>>; env.keyOn(); 0.1 => osc[0].gain; 0.08 => osc[1].gain; Std.mtof(59) => osc[0].freq; Std.mtof(64) => osc[1].freq; //4::second => now; 20::ms => now; } else if( msg.isButtonDown() && msg.which == 14) { // print <<< "down: j" >>>; env.keyOn(); 0.1 => osc[0].gain; 0.08 => osc[1].gain; Std.mtof(55) => osc[0].freq; Std.mtof(64) => osc[1].freq; //4::second => now; 20::ms => now; } else if( msg.isButtonDown() && msg.which == 15) { // print <<< "down: j" >>>; env.keyOn(); 0.1 => osc[0].gain; 0.1 => osc[1].gain; Std.mtof(57) => osc[0].freq; Std.mtof(69) => osc[1].freq; //4::second => now; 20::ms => now; } else if( msg.isButtonUp() && msg.which == 11 || msg.which == 13 || msg.which == 14 || msg.which == 15) { <<< "up:", msg.which >>>; env.keyOff(); 0 => osc[0].gain; 0 => osc[1].gain; } } } //Std.mtof(59) => osc[0].freq; //Std.mtof(64) => osc[1].freq; //4::second => now;