//---------------| // // Chuck-Trak for super 8 film of Leroy Bach building a poem // created in chuck and played on Banjo by Reed // -with much Help from Lawrence Fyfe, thank you. //--------------------------------------------------------------| [ // filenames "Br1.wav", "Br2.wav", "Br3.wav", "Br4.wav", "Br5.wav", "Br6.wav", "Br7.wav", "Br8.wav", "Br9.wav", "Br10.wav", "Br11.wav", "Br12.wav", "Br13.wav", "Br14.wav", "Br15.wav", "Br16.wav", "Br17.wav", "Br18.wav", "Br19.wav", "Br20.wav", "Br21.wav", "Br22.wav", "Br23.wav", "Br24.wav", "Br25.wav", "Br26.wav", "Br27.wav" ] @=> string filenames[]; // corresponding sndbuf SndBuf Br[filenames.cap()]; // our patch JCRev r => Echo a => Echo b => Echo c => Pan2 p1; // pan sweeper variable 0.0 => float t; // smaller == smoother 10::ms => dur T; // for each sndbuf for( int i; i < Br.cap(); i++ ) { Br[i] => r; 0 => Br[i].gain; filenames[i] => Br[i].read; } // set the gain .95 => r.gain; // set the reverb mix .075 => r.mix; // set max delay for echo 1000::ms => a.max => b.max => c.max; // set delay for echo 750::ms => a.delay => b.delay => c.delay; // set the initial effect mix 0.0 => a.mix => b.mix => c.mix; // gallop flag int gallop; // detune 0 => float retune; // center tuning 1 => float center; // shred to modulate the mix //fun = function and void = no return, return nothing fun void echo_Shred( ) { 0.0 => float decider => float mix => float old => float inc; // time loop while( true ) { Std.rand2f(0.0,1.0) => decider; if( decider < .35 ) 0.0 => mix; else if( decider < .55 ) .08 => mix; else if( decider < .8 ) .5 => mix; else .15 => mix; // find the increment (mix-old)/1000.0 => inc; 1000 => int n; // time loop while( --n ) { // set the mix for a, b, c old + inc => old => a.mix => b.mix => c.mix; 1::ms => now; } // remember the old mix => old; // let time pass until the next iteration //this says set the echo value between 2 and 6 Std.rand2(2,6)::second => now; } } // let echo shred go spork ~ echo_Shred(); // let gallop shred go spork ~ gallop_Shred(); // pan sweeper spork ~ p1_Shred(); int rand; int panRand; int panRand2; //this is the timer for the retune now + 118::second => time time1; now + 155::second => time time2; // our main loop while( true ) { // position //i=index 0-4 for 5 elements, and i++ means to advance by one //current means the current Snd file Std.rand2(0, 26) => rand; 0.7 => Br[rand].gain; //before playing move to the beginning of file 0 => Br[rand].pos; //this can be added to play specific file for timed duration //each SndBuf will play only for this ammount of time. //this could be added to create timing... //swap out the one below for the play one after another in full randomly Std.rand2(0, 3) => panRand; p1.left => dac.chan(panRand); panRand+1 => panRand2; if (panRand2 == 4) { 0 => panRand2; } p1.right => dac.chan(panRand2); if( now > time1 && now < time2 ) { if( gallop ) { <<< "gallop: YES", "center:", center, "retune:", retune >>>; // randomize rate //0.50 * Std.rand2f(center-retune,center+retune) => Br[rand].rate; //deactivate above one line and ... //activate the below to only have the "no" gallop in "retune" Std.rand2f(center-retune,center+retune) => Br[rand].rate; 500::ms => now; } else { <<< "gallop: NO", "" >>>; .5 => Br[rand].rate; Br[rand].length() => now; } } else { if( gallop ) { <<< "gallop: YES", "center:", center, "retune:", retune >>>; // randomize rate Std.rand2f(center-retune,center+retune) => Br[rand].rate; 600::ms => now; } else { <<< "gallop: NO", "" >>>; 1 => Br[rand].rate; Br[rand].length() => now; } } //before playing move to the beginning of file 0 => Br[rand].pos; } // gallop fun void gallop_Shred() { while( true ) { !gallop => gallop; Std.rand2f( 7, 17 )::second => now; } } // pan sweeper fun void p1_Shred() { while( true ) { // pan goes from -1 (left) to 1 (right) Math.sin(t) => p1.pan; // increment t (scaling by T) T / second * 2.5 +=> t; // uncomment to print out pan, last left, last right // <<>>; // advancde time T => now; } }