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
6SinOsc s => dac;
7SawOsc saw => dac;
8TriOsc tri => dac;
9PulseOsc pul => dac;
10SqrOsc sqr => dac;
11
12TriOsc trictrl => SinOsc sintri => dac;
13
14[ s, saw, tri, pul, sqr, trictrl ] @=> Osc oscillators[];
15
160.2 => s.gain;
170.1 => saw.gain;
180.1 => tri.gain;
190.1 => pul.gain;
200.1 => sqr.gain;
210.1 => sintri.gain;
222 => sintri.sync;
23
24while ( 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