[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[sc-users] Synth Definition Argument Control
I'm unsure how to control the values of SynthDef arguments when the
synth is not running.
If I create a SynthDef with some arguments and I want to trigger this
in a Task, how can I control the arguments, f.ex the frequency:
SynthDef("tutorial-sine", { arg out=0, amp=1.0, freq=140, i_dur=1.0;
var env, sine;
env = Line.kr(1, 0, i_dur, doneAction: 2, mul: amp);
sine = SinOsc.ar(freq, mul: env);
// output two channels on bus 0
Out.ar(0, [sine, sine]);
}).send(s);
// I then make a task
o = Task({
var startCycle;
loop{
startCycle = thisThread.clock.beats;
0.15.wait;
Synth("tutorial-sine");
(startCycle + 8.0 - thisThread.clock.beats).wait;
}
})
//then play it
~args = [TempoClock.default, true, [8.0, -0.15]]
o.play(*~args);
//bind n to it - hmm, this won't work, of course
n = Synth.new("tutorial-sine");
//change freq
n.set("freq", 440);
Of course this doesn't work, because the synth finishes. I want to
bind an argument so that I may control the frequency every time it
gets triggered in the task.
I intend to bind such arguments to a midi controller.
--
Esben Stien is b0ef@e s a
http://www. s t n m
irc://irc. b - i . e/%23contact
[sip|iax]: e e
jid:b0ef@ n n