// Tilt-o-flute.ck // by Perry Cook, March 11, 2009 // Hey there! This here is a mapping example // to control the STK Flute model from a variety // of sources on your laptop. Flute f => JCRev r => dac; 0.06 => r.mix; // Reverb wetness 1 => f.noteOn; // turn a note on /* Mini Audicle User Interface (Dan is scared of this) MAUI_View myWindow; myWindow.name("Tilt - o - Flute!!"); MAUI_Slider pitch; pitch.name("pitch (MIDI Note)"); pitch.range(60,96); MAUI_Button shutUp; shutUp.name("Exit"); shutUp.position(250.0,0); myWindow.addElement(pitch); myWindow.addElement(shutUp); myWindow.display(); 72.0 => pitch.value; // instantiate a HidIn object and message holder Hid hi; HidMsg msg; if( !hi.openTiltSensor() ) { // open tilt sensor <<< "tilt sensor unavailable", "" >>>; me.exit(); } 0.0 => f.vibratoGain; 0.1 => f.noiseGain; // adc => OnePole p => blackhole; // only use this if your // adc => p; 3 => p.op; // mic is away from your speakers // 0.999 => p.pole; // access: p.last()*0.02 => something while( shutUp.state() != 1 ) { hi.read( 9, 0, msg ); // 9, 0 = zeroeth accelerometer (msg.y+300.0) / 600.0 => f.pressure; (msg.x+300.0) / 600.0 => f.jetDelay; Std.mtof(pitch.value()) => f.freq; 10::ms => now; } myWindow.destroy(); /* Flute stuff you can use: .jetDelay - ( float , READ/WRITE ) - jet delay [...] .jetReflection - ( float , READ/WRITE ) - jet reflection [...] .endReflection - ( float , READ/WRITE ) - end delay [...] .noiseGain - ( float , READ/WRITE ) - noise component gain [0.0 - 1.0] .vibratoFreq - ( float , READ/WRITE ) - vibrato frequency (Hz) .vibratoGain - ( float , READ/WRITE ) - vibrato gain [0.0 - 1.0] .pressure - ( float , READ/WRITE ) - pressure/volume [0.0 - 1.0] .clear - ( ) - clear instrument .startBlowing - ( float , WRITE only ) - start blowing [0.0 - 1.0] .stopBlowing - ( float , WRITE only ) - stop blowing [0.0 - 1.0] .rate - ( float , READ/WRITE ) - rate of attack (sec) */