Debian Codegraph @

examples/book/digital-artists/chapter7/Listing7.6.ck

raw
1 // Listing 7.6 STK Mandolin UGen includes a body model and performance controls
2
3 Mandolin mand => dac; // (1) Mandolin physical instrument model
4
5 [79, 78, 74, 78, 76, 72] @=> int solomio[];
6
7 for (0 => int i; i < solomio.cap(); i++) {
8 Std.mtof(solomio[i]) => mand.freq;
9 Math.random2f(0.2,0.8) => mand.pluckPos; // (2) Random plucking position
10 Math.random2f(0.05,0.11) => mand.stringDetune; // (3) Random detune between strings in a pair
11
12 // (4) Tremolo strumming gesture
13 for (0 => int trem; trem < 12; trem++) {
14 1 => mand.noteOn;
15 Math.random2f(0.06,0.09) :: second => now;
16 }
17 }