Debian Codegraph @

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

raw
1 // Listing 7.2 Playing the ChucK STK Brass PM UGen
2
3 // Playing a PM UG trumpet in a nice space
4 Brass trump => NRev rev => dac;
5 0.1 => rev.mix;
6
7 // notes for our "exercise"
8 [82,84,86,84,82,84,86,84,82,77,86,86,89] @=> int notes[];
9
10 // play through the exercise, except for the last note
11 0 => int i;
12
13 while (i < notes.cap()-1)
14 {
15 0.8 => trump.startBlowing;
16 Std.mtof(notes[i]) => trump.freq;
17 0.1 :: second => now;
18 1 => trump.stopBlowing;
19 0.05 :: second => now;
20 i++;
21 }
22
23 // add a little breath vibrato for last note
24 0.4 => trump.vibratoGain;
25 0.8 => trump.startBlowing;
26 Std.mtof(notes[i]) => trump.freq;
27 second => now;
28 1 => trump.stopBlowing;
29 second => now;