3 // by: Ge Wang (gewang@cs.princeton.edu)
4 // Perry R. Cook (prc@cs.princeton.edu)
8 Mandolin mand => 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 ) => mand.pluckPos;
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 ) => mand.freq;
64 std.rand2f( 0.2, 0.9 ) => mand.pluck;
66 if( std.randf() > 0.8 )
68 else if( std.randf() > .85 )
70 else if( std.randf() > -0.9 )
71 { .125::second => now; }
74 1 => int i => int pick_dir;
76 4 * std.rand2( 1, 5 ) => int pick;
78 0.7 / (float)pick => float inc;
80 for( ; i < pick; i++ )
83 std.rand2f(.2,.3) + (float)i*inc => pluck;
84 pluck + -.2 * (float)pick_dir => mand.pluck;
85 // simulate pluck direction
86 !pick_dir => pick_dir;
88 // let time pass for final pluck