Debian Codegraph @

examples/multi/we-robot.ck

raw
1 // name: we-robot.ck
2 // desc: take us to your leader (talk into the mic), multi-channel
3 // author: gewang, prc
4 // note: ChucK can be started with as much channels as is
5 // supported on the underlyding audio device; this can be
6 // done on command line (see chuck --help for more info)
7 // or in the miniAudicle Preferences (note changes will
8 // not take effect until the ChucK VM is (re)started
9
10 // n channels
11 dac.channels() => int N;
12 // print
13 <<< "dac has", N, "channels..." >>>;
14
15 // delays
16 DelayL d[N];
17 // gains
18 Gain g3[N];
19
20 // our patch - feedforward part
21 adc => Gain g;
22 adc => Gain g2 => dac;
23
24 // set delays
25 for( int i; i < N; i++ )
26 {
27 // feedfoward
28 g => d[i] => dac.chan(i);
29 // feedback
30 d[i] => g3[i] => d[i];
31 // detune
32 30::ms + Math.random2f(-15,15)::ms => d[i].max => d[i].delay;
33 .95 => g3[i].gain;
34 }
35
36 // set parameters
37 0.25 => g.gain;
38 0.05 => g2.gain;
39
40 // time loop
41 while( true ) 100::ms => now;