History

chuck example update, batch 1

Ge Wang committed 5 years ago

Commit db7fbbf1 parent f66b62b10 files · +159 −55Browse files

Showing the changes to examples/basic (1 of 10 files). Show all

Unified · Split

examples/basic/oscillatronx.ck+36−0
@@ -0,0 +1,36 @@
1+// oscillator demo
2+// - philipd
3+
4+[ 0, 2, 4, 7, 9 ] @=> int f[];
5+
6+SinOsc s => dac;
7+SawOsc saw => dac;
8+TriOsc tri => dac;
9+PulseOsc pul => dac;
10+SqrOsc sqr => dac;
11+
12+TriOsc trictrl => SinOsc sintri => dac;
13+
14+[ s, saw, tri, pul, sqr, trictrl ] @=> Osc oscillators[];
15+
16+0.2 => s.gain;
17+0.1 => saw.gain;
18+0.1 => tri.gain;
19+0.1 => pul.gain;
20+0.1 => sqr.gain;
21+0.1 => sintri.gain;
22+2 => sintri.sync;
23+
24+while ( true ) {
25+
26+ Math.random2(0,7) => int select;
27+ if ( select > 5 ) 5 => select;
28+ Std.mtof( f[Math.random2( 0, 4 )] + 60 ) => float newnote;
29+ newnote => oscillators[select].freq;
30+ 0.25::second => now;
31+ for ( 0 => int i; i < 10; i+1 => i ) {
32+ Math.random2f (0.2, .8 ) => trictrl.width;
33+ 0.05 ::second => now;
34+ }
35+
36+}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t