Playing with synths that accept args whee

This commit is contained in:
Dan Buch 2015-10-21 17:38:36 -04:00
parent f6498b0a16
commit 3dc68aef05

View File

@ -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;
)