Proxies#
A Synth in SuperCollider consists of a network of UGens whose shape cannot be changed once it has started playing. Although this makes for a very efficient design, it limits interactivity. The Just In Time programming library (JITLib) [dCR05, RdC09, WCC11] attempts to overcome this limitation by introducing proxies, abstract placeholders which allow seamlessly switching between different audio graph definitions. When a new Synth definition is assigned to the proxy, the previous synth is stopped and a new one starts, usually using a cross-fade. This allows the use of dynamic modification and interconnection of proxies.
Proxy
A proxy is a placeholder that is used to operate on something that does not yet exist.
In a live programming environment, we often want to use something before it is there, e.g., to set up our setting in a non-linear way. For this reason, the JITLib of SuperCollider offers us different ways to define proxies.
For example, an OutputProxy is used to represent multiple outputs of a UGen, even if only one UGen is created eventually.
Proxies can be redefined, making them highly flexible and dynamic.
They can refer to functions, patterns, or tasks and work at either audio ar
or control kr
rate.
There are three types of proxies:
for synths: NodeProxy, Ndef, ProxySpace
for patterns: PatternProxy, PbindProxy, Pdef, Pdefn, Pbindef, Psym, Pnsym, Fdef, Pdict
In section Pattern, we already discussed some of these pattern proxies without calling them by this term. Wihtin one type these different classes are semantically interchangeable but translate to different programming styles.
Client and Server Side Proxies
Pattern and task proxies operate client side. Synth proxies, i.e. nodes, operate server side.
Definition Classes#
Definition-classes, such as Pdef, Tdef and Ndef, bind a symbol to an object in a specific way:
Pdef(\name) // returns the proxy
Pdef(\name, object) // sets the source and returns the proxy
Environments#
Another way, for server side node proxies, is an environment that returns placeholders on demand. Environments manage namespaces, e.g.
~a = 4
is equivalent to
currentEnvironment.put(\a, 4)
The default currentEnvironment
provides us with client side variables.
Using
ProxySpace.push(s) // s is a audio server
exchanges this client side ‘variable’ environment with a server side environment holding NodeProxies. As a consequent
~a = {SinOsc.ar(244!2) * 0.5;}
is no longer a standard sclang
variable but a node proxy on the server!
Lower Level Proxies#
We can also create our own low-level proxy object using TaskProxy, PatternProxy or NodeProxy respectively.