// Functional Iteration Synthesis - http://emoc.org/hackpact/ - sep 2009 0 => int deviceNum; Hid hi; HidMsg msg; if( !hi.openMouse( deviceNum ) ) me.exit(); Step s => dac; .5 => s.gain; 5 => int iterations; - Math.PI => float n; // current sample 3 => float r; // parameter of function float o; // current sample value .00001 => float velocity; // orbital velocity fun void sound() { while (1::samp => now) { n => o; // f(n) = sin (r * n), iterated {iterations} times for(int i; i <= iterations; i++) Math.sin(o*r)=>o; o => s.next; n + velocity => n; if (n > Math.PI / 2) - Math.PI => n; } } spork ~ sound(); while(true) { hi => now; while( hi.recv( msg ) ) { if( msg.isMouseMotion() ) { if( msg.deltaX ) { // move mouse left & right to modify r r + msg.deltaX$float/500 => r; if (r < 2) 2 => r; if (r > 4) 4 => r; <<<"r", r>>>; } else if ( msg.deltaY ) { // move up & down to modify velocity velocity + msg.deltaY$float/50000 => velocity; if (velocity < 0) 0 => velocity; <<<"velocity : ", velocity>>>; } } else if( msg.isButtonDown() ) { // left button to ++ iterations // right button to -- iterations if (msg.which == 0) iterations++; if (msg.which == 1) iterations--; if (iterations < 1) 1 => iterations; if (iterations > 13) 13 => iterations; <<>>; } } }