// Slork 2013 // Week 2 ChucK Tutorial // Keyboard control // Spencer Salazar - spencer@ccrma.stanford.edu // setup our audio SawOsc osc => NRev reverb => dac; 0.05 => reverb.mix; // open the keyboard Hid keyboard; keyboard.openKeyboard(0); HidMsg msg; while(true) { // wait for the keyboard to generate input keyboard => now; // receive the input while(keyboard.recv(msg)) { // a button was pressed if(msg.type == Hid.BUTTON_DOWN) { <<< "button down:", msg.ascii >>>; // play sound msg.ascii => Std.mtof => osc.freq; 1 => osc.gain; } // a button was released else if(msg.type == Hid.BUTTON_UP) { // stop sound 0 => osc.gain; } } }