// chuck fakeGametrak.ck // fake data from SinOscs // SawOsc through resonator, parameters controlled by simulated gametrak // X dimension to formant freq // Y to SawOsc freq // Z to SawOsc gain SawOsc buzz => ResonZ f => NRev r => dac; // set filter Q 100 => f.Q; r.mix(0.1); // spork control spork ~ gametrak(); // print spork ~ print(); float gtAxis[6]; SinOsc axis[6]; for( 0 => int i; i < 6; i++ ) { axis[i] => blackhole; axis[i].freq( 0.2 / (i+1)$float); } fun void print() { while( true ) { // values <<< "axes:", gtAxis[0],gtAxis[1],gtAxis[2], gtAxis[3],gtAxis[4],gtAxis[5] >>>; 100::ms => now; } } // 3-axis gametrack simulation fun void gametrak() { while( true ) { // wait on HidIn as event 1::ms => now; for( 0 => int which; which < 6; which++ ) { axis[which].last() => float axisPosition; // the z axes map to [0,1], others map to [-1,1] if( which != 2 && which != 5 ) { axisPosition => gtAxis[which]; } else { 1 - ((axisPosition + 1) / 2) => gtAxis[which]; if( gtAxis[which] < 0 ) 0 => gtAxis[which]; } } } } while(true){ // gt values range from -1.0 to 1.0 100 + (gtAxis[0] + 1.0) * 1000 => f.freq; (gtAxis[1] * 600) + 630=> buzz.freq; (gtAxis[2] + 1.0) * 0.5 => buzz.gain; 1::samp => now; }