[linux-audio-dev] Does anyone have a working example of Supercollider and SCUM GUI where slider or a button does real-time update on the synth
stefan kersten
steve at k-hornz.de
Wed May 18 10:34:17 UTC 2005
On Tue, May 17, 2005 at 07:46:58PM -0400, Ivica Bukvic wrote:
> SynthDef("onetwoonetwo",{ arg out=0, freq;
> w = SCUMWindow.new;
> w.title = "Slider example";
> w.initialSize = Size(20, 300);
>
> c = SCUMVBox( w );
>
> v = SCUMSlider(c, { |v|
> v.expand = 1;
> v.fill = 1;
> v.bgColor = Color.white;
> v.fgColor = Color.black;
> v.action = {
> freq = v.value * 100;
> };
> v.doAction;
> });
> w.show;
>
> Out.ar(out,
> SinOsc.ar(freq + 400, 0, 0.5)
> )
> }).play;
>
> What I am simply trying to do is to affect the frequency of the sinetone by
> moving the slider, yet nothing changes when I move the slider.
you're mixing up the server and language contexts. when you
write a synthdef, the code is not executed on the server but
merely used to build a graph of unit generators and compile
it into a binary representation. by assigning `freq' in the
view's action, you set the value at the time the synthdef is
built.
you'll have to split up the code:
s = Server.local.boot;
SynthDef(\testfest, { arg out=0, freq=440;
Out.ar(out, SinOsc.ar(freq, mul: 0.5))
}).send(s);
z = Synth(\testfest);
(
w = SCUMWindow.new;
w.title = "Slider example";
w.initialSize = Size(20, 300);
c = SCUMVBox(w);
v = SCUMSlider(c, { |v|
v.expand = 1;
v.fill = 1;
v.bgColor = Color.white;
v.fgColor = Color.black;
v.action = { z.set(\freq, v.value * 100 + 400) }
v.doAction;
});
w.show;
)
hth,
<sk>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.linuxaudio.org/pipermail/linux-audio-dev/attachments/20050518/2107b61b/attachment.pgp>
More information about the Linux-audio-dev
mailing list