Ndef:
Filter:
Classes | JITLib > NodeProxy | Live Coding

Ndef : NodeProxy : BusPlug : AbstractFunction : Object

node proxy definition
Source: NodeProxy.sc

Description

Ndef registers synths by key. All accesses to the registered synths go through the Ndef class via that key. Registered synths can be replaced with other synths while playing. A synth and its replacement can automatically crossfade and the replacement time can be quantized.

Ndef is a reference to a proxy, forms an alternative to ProxySpace. All methods are inherited from NodeProxy.

Graphical editor overviewing all current Ndefs: NdefMixer. A general overview: JITLib.

First Example

Class Methods

Creation

Ndef.new(key, object)

Return a new node proxy and store it in a global ProxySpace under the key. If there is already an Ndef there, replace its object with the new one. The object can be any supported class, see NodeProxy: Supported sources help.

Arguments:

key

the name of the proxy (usually a symbol). If only the key is given and no object, it returns the proxy object:

If key is an association, it is interpreted as key -> server name. (order changed in SC3.3 !). If no name is given, it uses the default server that was default when Ndef was first called. (to change it, see *defaultServer).

object

an object

Ndef.ar(key, numChannels, offset: 0)

equivalent to *new(key).ar(numChannels, offset) (see BusPlug: -ar)

Ndef.kr(key, numChannels, offset: 0)

equivalent to *new(key).kr(numChannels, offset) (see BusPlug: -kr)

Ndef.clear(fadeTime)

clear all proxies

Ndef.defaultServer

Ndef.defaultServer = value

set the default server (default: Server.default)

Ndef.all

Ndef.all = value

Return the dictionary of all servers, pointing to proxyspaces with Ndefs for each.

Ndef.dictFor(server)

Return the proxyspace for a given server.

Setting default parameters

Behind every Ndef there is one single instance of ProxySpace per server used (usually just the one for the default server). This ProxySpace keeps default values for the proxies that can be set. This can be done by:

The other values that can be set in such a way are: clock, fadeTime, quant, reshaping, awake.

Inherited class methods

Instance Methods

Inherited instance methods

Undocumented instance methods

.copy(toKey)

.dup(n: 2)

.key

.key = value

.proxyspace

Examples

using Ndef inside other Ndefs

setting and mapping parameters

Reserved parameters

Three parameters are automatically specified if they don't exist in a given UGen function. You can override their use: [\out, \gate, \fadeTime]

Specifying your own envelope

If a UGen function that is passed to the proxy has its own envelope, and if this envelope can free the synth, the node proxy uses this envelope instead of making its own. If you provide a fadeTime argument, the proxy's fadeTime will be used.

Simple audio routing with the <<> operator

Embedding multi-channel Patterns, playing Streams in parallel

Controlling multi-channeled sequenced streams and having independent control over filtering and node ordering is a difficult topic in SuperCollider. However, using Ndefs (or their superclass NodeProxy or a ProxySpace) may provide a convenient solution.

Making Copies

copy

Because an Ndef is a unique instance for a given key, it can be copied only by supplying a new key. See also: NodeProxy: -copy.

Arguments:

newKey

A valid new key, usually a Symbol

Recursion

Ndefs can be used recursively. A structure like the following works:

This is because there is a feedback delay (the server's block size), usually 64 samples, so that calculation can reiterate over its own outputs. For single sample feedback, see:

Using different servers

GUI

Using Associations

For a complete list, see NodeProxy, and NodeProxy roles