3 // by: Ge Wang (gewang@cs.princeton.edu)
4 // Perry R. Cook (prc@cs.princeton.edu)
8 StifKarp karp => JCRev r => Echo a => Echo b => Echo c => dac;
13 // set max delay for echo
14 1000::ms => a.max => b.max => c.max;
16 750::ms => a.delay => b.delay => c.delay;
17 // set the initial effect mix
18 0.0 => a.mix => b.mix => c.mix;
20 // shred to modulate the mix
21 fun void echo_shred( )
23 0.0 => float decider => float mix => float old => float inc;
28 std.rand2f(0.0,1.0) => decider;
29 if( decider < .35 ) 0.0 => mix;
30 else if( decider < .55 ) .08 => mix;
31 else if( decider < .8 ) .5 => mix;
35 (mix-old)/1000.0 => inc; 1000 => int n;
39 // set the mix for a, b, c
40 old + inc => old => a.mix => b.mix => c.mix;
45 // let time pass until the next iteration
46 std.rand2(2,6)::second => now;
57 std.rand2f( 0.2, 0.8 ) => karp.pickupPosition;
59 2 * std.rand2( 0, 4 ) => int freq;
60 if( freq == 6 ) 7 => freq; if( freq == 8 ) 9 => freq;
61 220.0 * math.pow( 1.05946, (float)(std.rand2(0,2)*12)
62 +(float)freq ) => karp.freq;
65 std.rand2f( 0.2, 0.9 ) => karp.pluck;
67 if( std.randf() > 0.8 )
69 else if( std.randf() > .85 )
71 else if( std.randf() > -0.9 )
72 { .125::second => now; }
75 1 => int i => int pick_dir;
77 4 * std.rand2( 1, 5 ) => int pick;
79 0.7 / (float)pick => float inc;
81 for( ; i < pick; i++ )
84 std.rand2f(.2,.3) + (float)i*inc => pluck;
85 (float)i * 0.025 => karp.stretch;
86 pluck + -.2 * (float)pick_dir => karp.pluck;
87 // simulate pluck direction
88 !pick_dir => pick_dir;
90 // let time pass for final pluck