NPModules:
Filter:
Classes (extension) | Live Coding > ProxySpace

NPModules
ExtensionExtension

registry of small reusable module functions for NodeProxy
Location: NOT INSTALLED!

Description

Provides a light-weight way to define and reuse small signal / filter / utility modules to populate a NodeProxy.

Instead of writing full functions each time, you can reference a named module.

Class Methods

.new

Arguments:

proxyspace

The ProxySpace this instance operates on. Defaults to the Ndef proxyspace for the default server. If not the default Ndef proxyspace, the instance must be named and thus included in ProxySpace.all.

Returns:

An NPModules instance.

.parentDict

The prototype dictionary of built-in modules. Can be adapted and extended for global changes. Changing elements here is propagated to existing NPModules instances, however, existing instances in NodeProxy instances are not updated automatically.

.all

A dictionary of all NPModules instances.

.registerToAbstractPlayControl

announces the \module -> role for NodeProxy instances. See NodeProxy roles .

.put

add a mmodule to all existing instances. Note that the instances need to be registered in NPModules.all, i.e. meed to be called at least once for this to work.

Arguments:

key

Symbol name to bind.

value

Function receiving a dict and returning either a UGen function or a role mapping.

updateNodes

Boolean (default false).

.krFunc

helper function to create kr control functions with index suffix to avoid name clashes when multiple instances of the same module are used e.g. \freq -> \freq0, \freq1, ...

Arguments:

name

the base name (Symbol).

spec

the spec to use

dict

the dictionary passed to the module function. This contains, among other things, the idx of the module instance in the NodeProxy and numChans of the NodeProxy.

lag

lag time. defaults to 0

Returns:

A function that returns a NamedControl with the appropriate name and spec.

Inherited class methods

Instance Methods

.moduleDict

dictionary of modules.

.moduleKeys

Returns:

A Set of all module names (Symbol) available.

.proxyspace

The proxyspace dictionary this instance operates on.

.at

Arguments:

key

Symbol name of module.

Returns:

The module function (or role-returning function) or nil if not found.

.put

Arguments:

key

Symbol name to bind.

value

Function receiving a dict and returning either a UGen function or a role mapping.

updateNodes

Boolean (default false).

Returns:

The value inserted.

Inherited instance methods

Examples

Distort a custom sound (in slot 0):

Write your own module by adding it to the registry for the relevant ProxySpace:

Then use it in a proxy:

Change the sound by redefining the module:

For integration reasons, any valid NodeProxy role is also accepted as a module: