Fundamentals
Export Targets
Code Export
Patcher UI
Special Topics
RNBO Raspberry Pi OSCQuery Runner
Using Parameters
RNBO patchers expose their parameters to target platforms using special objects called param and param~. This allows for easy control of parameter values, and reference of parameter states on any target platform.
Parameter Namespace and Naming
You can set a parameter’s identifier using the first argument. You can also use the @displayname
attribute to set the name of the parameter as it will appear when exported. Use the @value
attribute to set the default value, and use @min
and @max
to set the parameter limits.
Parameter Ranges and Normalization
The right outlet of param outputs the current normalized value of the parameter between zero and one. For this to work correctly, you must first set the parameter’s @min
and @max
attributes. Values above and below the input range will be clipped. All param and param~ objects have a default range of 0. to 1.
The @fromnormalized
and @tonormalized
attributes define how the range 0 to 1 is mapped to the @min
and @max
parameter value, allowing you to use your own form of non-linear scaling.
These attributes work with the tonormalized and fromnormalized objects which also have signal rate versions. To bind these objects to your parameters, use the parameter name as the argument to the object. For example, [tonormalized freq]
will bind to a parameter written as [param freq @min 0 @max 10].
For example, to control the normalization of the frequency range 20 to 20480 Hertz logarithmically: use the expression @tonormalized log2(value / 20) / 10.
Likewise, if you’d like to convert the normalized range back to its original parameter range, use the @fromnormalized
attribute. For instance, to revert the logarithmic scaling above, use the expression @fromnormalized pow(2, value * 10) * 20.
Enumerated Parameters
Enumerated parameters can be useful when creating parameter-based modes for your patch. For instance, if you’d like to create an oscillator waveform parameter, create a param object with the name waveform and use the @enum
attribute followed by the symbols you’d like to use for your enumerated parameter, for example sine
, saw
, square
, and noise
. Now this can be connected to a selector~ object, and the selected symbol name will open the appropriate inlet. To set a default value, make the @value
of the parameter the index of the default enum value. Here we’re defaulting to rect by setting @value 2.
Other Param Attributes
The @unit
attribute allows you to add a descriptive symbol to the parameter indicating the type of value to be expected. i.e., hz, dB, 14-bit, or ms.
The order in which the parameters are loaded can be controlled using the @order
attribute. This can be numeric or using 'first' and 'last'. On certain targets you might want to set the gain first, or last for instance.
Controlling Params with Messages
In Max, RNBO parameters appear as attributes of the containing rnbo~ object. Using the standard syntax of <attribute name> <value>
allows for access to those parameters. We can use that syntax in the form of a box argument in the rnbo~ object.
All parameters are exposed as attributes of the containing rnbo~ objects, allowing you to access them via objects like attrui or control them with messages by name.
A param or param~ object nested inside a subpatcher or abstraction gets named based on the respective subpatcher and param object names in the form subpatchername/paramname
. Therefore, a param object named frequency
that is in a rnbo subpatcher named "oscillator1" would be named oscillator1/frequency
.
In the case that the subpatcher or abstraction is not named, a unique random name in the form rnbo_obj-<int>
is generated.
If you need to set a parameter inside a subpatch from within rnbo~ you can use the set object. This also works the same for parameters in gen~ subpatchers inside of RNBO.
Parameters and Polyphony
The @exposevoiceparams 1
attribute can be used with gen~ or polyphonic p objects to simplify access and control of any contained parameters.
If our RNBO patch is polyphonic (the @polyphony
attribute is set to something greater than one), then setting the parameter value will set every polyphonic voice to use the same value for that parameter. RNBO subpatchers (the p object inside rnbo~) have an @exposevoiceparams
attribute. Setting this to something other than zero will expose an individually addressable parameter for each polyphonic voice. Use this if you want greater control over the state of individual voices.
Exposing Gen parameters
Adding the @exposeparams 1
attribute to any gen~ object will expose any contained param objects as top level attributes of rnbo~. The parameter path is always the varname
of the gen~ object (which must be set in the inspector) followed by a forward slash and the name of the param. If no varname is present, then gen~ is assigned a unique pathname in the format gen_tilde_<number>/<param name>
, where <number> is a random integer.
Parameters in External Targets
A "parameter" is something that exists in the RNBO language only, but it defines something concrete: a settable, retrievable part of the RNBO patch state, with a unique identifier. Different targets are able to wrap this RNBO construct in different ways. We've already seen how Max "wraps" the RNBO parameter as a Max attribute (through the rnbo~ object), exposing RNBO parameters to the attrui object. If you export your RNBO patch as a VST, then RNBO parameters will be exposed as VST parameters. This means that they can be saved as part of a VST preset. Each target may wrap parameters slightly differently, but always in a way that maintains the idea of a parameter as identifiable, settable state.
Presets
By default, snapshots and presets capture the current state of all RNBO param objects. If you would like to exclude a parameter from the preset system, use the @preset 0
attribute. param~ objects are not includable in presets.
The rnbo~ object is exposed to the Max snapshot system. That means that you can save the state of all presets in a RNBO patch as a Max snapshot. When you export, these snapshots will be available as presets. Like parameters, different targets will wrap RNBO presets differently. When you export to a VST, RNBO presets will be available as VST presets. For more information, see Presets with Snapshots.
Materials in this article