Debian Codegraph @

examples/basic/wind2.ck

raw
1 // noise generator, biquad filter, dac (audio output)
2 Noise n => BiQuad f => dac;
3 // set biquad pole radius
4 .99 => f.prad;
5 // set biquad gain
6 .05 => f.gain;
7 // set equal zeros
8 1 => f.eqzs;
9 // our float
10 0.0 => float t;
11
12 // concurrent control
13 fun void wind_gain( )
14 {
15 0.0 => float g;
16
17 // time loop to ramp up the gain / oscillate
18 while( true )
19 {
20 Std.fabs( Math.sin( g ) ) => n.gain;
21 g + .001 => g;
22 10::ms => now;
23 }
24 }
25
26 // run wind_gain on anothre shred
27 spork ~ wind_gain();
28
29 // infinite time-loop
30 while( true )
31 {
32 // sweep the filter resonant frequency
33 100.0 + Std.fabs(Math.sin(t)) * 15000.0 => f.pfreq;
34 t + .01 => t;
35 // advance time
36 100::ms => now;
37 }