// patch SndBuf buf[2]; Envelope e[2]; buf[0] => e[0] => dac; buf[1] => e[1] => dac; "../220b/hw2/soundfiles/coffee4.wav" => buf[0].read; "../220b/hw2/soundfiles/coffee4.wav" => buf[1].read; 0.5 => buf[0].rate; 0.5 => buf[1].rate; // logistic equation // chaotic for 3.57 < lambda < 4 3.57 => float lambda; 0.1 => float x; now + 100::second => time later; 1 => int increase; // counter to switch between buffers 0 => int theBuf; float lastx; float diffx; while( x < 1 && now < later ) { x => lastx; // logistic map <<< lambda >>>; lambda*(x-Math.pow(x, 2)) => x; x - lastx => diffx; // change some parameters here if( theBuf == 0 ) { (x*1) => e[1].time; //.12 => e[1].time; e[1].keyOff( ); (x*buf[0].samples( )) $ int => buf[0].pos; 2.0*diffx => buf[0].rate; (x*1) => e[0].time; //.12 => e[0].time; e[0].keyOn( ); 1 => theBuf; } else { (x*1) => e[0].time; //.12 => e[0].time; e[0].keyOff( ); (x*buf[1].samples( )) $ int => buf[1].pos; 2.0*diffx => buf[1].rate; (x*1) => e[1].time; //.12 => e[1].time; e[1].keyOn( ); 0 => theBuf; } // ramp up if( lambda < 4.0 && increase == 1 ) { lambda + 0.001 => lambda; } // switch if( lambda > 3.999999 && increase == 1 ) { 0 => increase; } // ramp down if( lambda > 3.57 && increase == 0 ) { lambda - 0.001 => lambda; } // switch if( lambda <= 3.57 && increase == 0 ) { 1 => increase; } (x*1000)::ms => now; //120::ms => now; } 50::second => now;