From c9d391ceeb2485d3af0f1dd0b33d9eb1ba1a07f5 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Sun, 17 Sep 2017 20:21:02 -0400 Subject: [PATCH] Other misc bits of sclang --- sclang-play/misc.sc | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 sclang-play/misc.sc diff --git a/sclang-play/misc.sc b/sclang-play/misc.sc new file mode 100644 index 0000000..42d2d44 --- /dev/null +++ b/sclang-play/misc.sc @@ -0,0 +1,41 @@ +( + s.boot; +) + +( + s.stop; +) + +// modulate a sine frequency and a noise amplitude with another sine +// whose frequency depends on the horizontal mouse pointer position +( + { + var x = SinOsc.ar(MouseX.kr(1, 100)); + SinOsc.ar(300 * x + 800, 0, 0.1) + PinkNoise.ar(0.1 * x + 0.1) + }.play; +) + +// simple synth definition using the Atari2600 UGen: +( + SynthDef( + \atari2600, { + |out=0, gate=1, tone0=5, tone1=8, freq0=10, freq1=20, amp=1, pan=0| + var e, z; + e = EnvGen.kr(Env.asr(0.01, amp, 0.05), gate, doneAction: 2); + z = Atari2600.ar(tone0, tone1, freq0, freq1, 15, 15); + Out.ar(out, Pan2.ar(z * e, pan)); + }).add +) + +// and a pattern to play it: +( + Pbind( + \instrument, \atari2600, + \dur, Pseq([0.25, 0.25, 0.25, 0.45], inf), + \amp, 0.8, + \tone0, Pseq([Pseq([2, 5], 32), Pseq([3, 5], 32)], inf), + \tone1, 14, + \freq0, Pseq([Pbrown(28, 31, 1, 32), Pbrown(23, 26, 3, 32)], inf), + \freq1, Pseq([Pn(10, 16), Pn(11, 16)], inf) + ).play +)