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. Internally, all instances are kept in a ProxySpace. The EnvironmentRedirect: dispatch function is called when the source is set.

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 Ndefs in all proxyspaces of the Ndef class

Ndef.clearDict(fadeTime)

clear all Ndefs and remove all proxyspaces of the Ndef class

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.

Inherited class methods

Undocumented class methods

Ndef.gui(server, numItems, bounds, preset)

From extension in /usr/local/share/SuperCollider/SCClassLibrary/JITLib/GUI/extJITgui.sc

Instance Methods

.proxyspace

Return the proxyspace for this instance

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.

.equi: METHOD NOT FOUND!

Process the receiver through a 5 band parametric EQ. This uses the \filter NodeProxy role. The EQ UGens used are from the BEQSuite, and consist of a BLowShelf, three BPeakEQs, and a BHishelf. They can be controlled by an EQui, or directly using the following control names: Possible parameters are 'loShelfFreq', 'loShelfGain', 'loShelfRs', 'loPeakFreq', 'loPeakGain', 'loPeakRq', 'midPeakFreq', 'midPeakGain', 'midPeakRq', 'hiPeakFreq', 'hiPeakGain', 'hiPeakRq', 'hiShelfFreq', 'hiShelfGain', 'hiShelfRs', and 'lagEQ' (a lag time for all parameter changes). These names should be preceded by prefix (see below) if one was supplied. Unlike the UGen methods this will automatically create the GUI as well as the EQ UGens.

Arguments:

params

An optional instance of EQuiParams containing initial parameter values.

lag

A lag time used when changing parameter values.

index

An index for the equi \filter node. The default is 1000.

openWindow

An Boolean indicating whether an EQui window should be opened. The default is true.

Returns:

The receiver.

.stateCS: METHOD NOT FOUND!

compileString representing the current state of the Ndef

Returns:

the string

.pbcopyState: METHOD NOT FOUND!

copy the state to the OS pasteboard

Inherited instance methods

Undocumented instance methods

.copy(toKey)

.dup(n: 2)

.key

.key = value

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