getSpec:
Filter:
(extension) Guides

getSpec
ExtensionExtension

Using Specs for proxy (and object) parameters: getSpec, addSpec, and specs

Using Specs for proxy parameters: getSpec, addSpec, getUni, setUni

JITLib proxies like PatternProxy (and thus TaskProxy, Pdef, and Tdef) and NodeProxy/Ndef and other objects have numerical settings, for which defining a Spec is useful: a practical mininum, maximum and curve (warp).

SuperCollider has a global dictionary of specs for commonly used parameter names, which is accessible directly and with shortcuts:

Storing specs globally is quick and convenient, and works well when the intention is that the same parameter names have the same range everywhere. But when working with many objects, one may accidentally re-use a globally existing spec name, define it to the desired range for the new object, and thus overwrite the range that spec had so far. This can be very confusing. Also, for proxy A one might want e.g. modFreq to have a range of [1, 10, \exp], while for proxy B, modFreq should better be tuned to [3, 30, \exp].

For such cases, in the JITLibExtensions quark, addSpec and getSpec allow storing parameter ranges individually for proxies, and any other objects that use .set methods for named parameters.

This makes it easy to set, access, and finetune specific ranges for the parameters of a single process, e.g. for GUIs and other interfaces:

Using Specs for NodeProxy and Ndef: getSpec, addSpec, and specs

For historical reasons, NodeProxy (and Ndef) has two ways to define a spec for a given parameter name:

There can be a spec for the same parameter name in these two places, they can be different, so it is necessary to decide which one will be used by priority. In JITLibExtensions, addSpec / Halo gets priority over implicit specs; so if nothing is found in the Halo, then we look in proxy.specs, and then we look in Spec.specs.

This precedence is useful for tuning specs while the sound continues: Once a good spec is found, one can place it back in the synth func. If you always prefer to use implicit specs, just use implicit specs only, or at least avoid also using addSpec for the same parameter name.

Tests and Examples for using addSpec and implicit specs

Test precedence with a global spec being present: