Debian Codegraph @

examples/basic/whole.ck

raw
1 // another candidate for least exciting demo
2
3 // patch
4 SinOsc s => JCRev r => dac;
5 .5 => r.gain;
6 .075 => r.mix;
7
8 // note number
9 20 => float note;
10
11 // go up to 127
12 while( note < 128 )
13 {
14 // convert MIDI note to hz
15 Std.mtof( note ) => s.freq;
16 // turn down the volume gradually
17 .5 - (note/256.0) => s.gain;
18
19 // move up by whole step
20 note + 2 => note;
21
22 // advance time
23 .125::second => now;
24 }
25
26 // turn off s
27 0 => s.gain;
28 // wait a bit
29 2::second => now;
30