[linux-audio-user] Re: [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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ivica Bukvic <ico@xxxxxxxx> writes:

> Greetings all,
>
> I guess title says it all. I do have working examples (i.e. the sequencer 
> example from the LAD 2004) that make new instances of synths but none of them 
> actually do real-time updates to existing instances.
>
> At any rate I would greatly appreciate your help in this matter.
>
> This is as far as I got and cannot figure it out beyond this point (my brain 
> is pretty darn fried :-):
>
> s = Server.local.boot;
>
> SynthDef("onetwoonetwo",{ arg out=0, freq;

You are tripping over a common Client-Server-Architecture misunderstanding
here.  The code inside a SynthDef is only executed *once* at
the client side to construct the Synth graph.  You
can *not* set variables insides a SynthDef from client side GUI objects directly.

What you actually want is:

* A synthDef with arguments which represent the values you want to change.
* A client side GUI with callbacks that *set* the server-side
  Synth arguments on update.

I will try to illustrate, but I dont use SCUM, so its untested,
but I am pretty sure you'll get the idea:

SynthDef("onetwoonetwo",{ arg out=0, freq=440;
 	Out.ar(out,
 		 SinOsc.ar(freq, 0, 0.5)
 	)
}).send(s);

n=Synth(\onetwoonetwo);

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 = {
		n.set(\freq, (v.value * 100)+400);
	};
	v.doAction;
});
w.show;

-- 
CYa,
  Mario

[Index of Archives]     [Linux Sound]     [ALSA Users]     [Pulse Audio]     [ALSA Devel]     [Sox Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux