From 3dc68aef052d7ca3dcf90a498f60f8add06eb755 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Wed, 21 Oct 2015 17:38:36 -0400 Subject: [PATCH] Playing with synths that accept args whee --- sclang-play/tutorial.sc | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/sclang-play/tutorial.sc b/sclang-play/tutorial.sc index bdccf2a..61e7523 100644 --- a/sclang-play/tutorial.sc +++ b/sclang-play/tutorial.sc @@ -194,6 +194,44 @@ z = Synth("tutorial-Rand"); ) +( + SynthDef( + "tutorial-args", + { + |freq = 440, out = 0| + Out.ar(out, SinOsc.ar(freq, 0, 0.2)) + } + ).add; + Task({ + x = Synth("tutorial-args"); + 1.wait; + y = Synth("tutorial-args", ["freq", 660]); + 1.wait; + z = Synth("tutorial-args", ["freq", 880, "out", 1]); + 1.wait; + x.free; y.free; z.free; + }).play; +) + +( + SynthDef.new( + \tutorialargs, + { + |freq = 440, out = 0| + Out.ar(out, SinOsc.ar(freq, 0, 0.2)); + } + ).add; + Task({ + x = Synth(\tutorialargs); + 1.wait; + x.set(\freq, 660); + 1.wait; + x.set(\freq, 880, \out, 1); + 1.wait; + x.free; + }).play; +) + ( s.scope; )