History

Merge pull request #281 from terryzfeng/patch-1

Update oscillatronx example

Ge Wang committed 3 years ago

Commit abf4d982 parents cd9bf56 8bf95cd1 file · +14 −9Browse files

Unified · Split

examples/basic/oscillatronx.ck+14−9
@@ -1,5 +1,10 @@
1−// oscillator demo
2−// - philipd
1+//------------------------------------------------------------------
2+// name: oscillatronx (oscillator demo)
3+// desc: playing all of the different types of oscillator UGens
4+// mixing together different timbres to create a sonic texture
5+//
6+// author: philipd
7+//------------------------------------------------------------------
38
49 // scale degrees in semi-tones
510 [ 0, 2, 4, 7, 9 ] @=> int f[];
@@ -10,7 +15,7 @@ SawOsc saw => dac; · 4 unmodified lines
1015 TriOsc tri => dac;
1116 PulseOsc pul => dac;
1217 SqrOsc sqr => dac;
13−// modulator and carrier
18+// FM modulator and carrier
1419 TriOsc trictrl => SinOsc sintri => dac;
1520 // interpret input as frequency modulation
1621 2 => sintri.sync;
@@ -31,17 +36,17 @@ TriOsc trictrl => SinOsc sintri => dac; · 14 unmodified lines
3136 while( true )
3237 {
3338 // randomize
34− Math.random2(0,7) => int select;
39+ Math.random2(0,7) => int select;
3540 // clamp (giving more weight to 5)
36− if( select > 5 ) 5 => select;
41+ if( select > 5 ) 5 => select;
3742 // generate new frequenc value
38− Std.mtof( f[Math.random2( 0, 4 )] + 60 ) => float newnote;
43+ Std.mtof( f[Math.random2( 0, 4 )] + 60 ) => float newnote;
3944 // set frequency
40− newnote => oscillators[select].freq;
45+ newnote => oscillators[select].freq;
4146 // wait a bit
42− 0.25::second => now;
47+ 0.25::second => now;
4348 // 10 times
44− repeat(10)
49+ repeat(10)
4550 {
4651 Math.random2f( 0.2, 0.8 ) => trictrl.width;
4752 // <<< "trictrl width:", trictrl.width() >>>;

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