Debian Codegraph @

examples/book/digital-artists/chapter2/Listing2.7.ck

raw
1 // Listing 2.7 Automatic panning using Pan2 and the Math.sin() function
2
3 //sound chain: white noise to pan2 to dac
4 Noise n => Pan2 p => dac;
5
6 //noise can sound quite loud
7 0.2 => n.gain;
8
9 // infinite loop
10 while (true)
11 {
12 //oscillate pan between 1.0 and -1.0
13 Math.sin(now/second) => p.pan;
14 //do it pretty often, to make it smooth
15 ms => now;
16 }