Fundamentals
Export Targets
Code Export
Patcher UI
Special Topics
RNBO Raspberry Pi OSCQuery Runner
Polyphony and Voice Control in Detail
There are two primary methods of polyphonic voice allocation in RNBO: simple and user
All RNBO patches can be polyphonic, including the root patcher managed by rnbo~ as well as each RNBO subpatcher. You can set the maximum number of polyphonic voices using @polyphony
attribute, which essentially copies the RNBO patcher for each polyphonic voice.
The root RNBO patcher always has the simple
voice controller, which automatically routes MIDI note events to free voices. RNBO subpatchers use the simple
voice controller by default, but can also disable automatic voice control by setting the @voicecontrol
attribute to user
.
Simple Polyphony
Any RNBO patcher can be made polyphonic by simply adding the @polyphony
attribute followed by a number value to specify the maximum number of voices.
Voice allocation happens automatically for all voices whenever @polyphony <int>
is set. In simple
voice allocation, each new MIDI note is routed to the next free voice until the maximum number of voices is reached. Subsequent note events will replace (steal) voices based on the order they were received, starting from the oldest events. Individual voices can be muted using the voice object in combination with objects like adsr~ (which sends a bang when the envelope finishes) or silencedetector~.
Setting Polyphonic Voice Count in Target Exports
You can also adjust polyphony of the root RNBO patcher during target export configuration. In the configuration panel of the export sidebar there is a setting called "Codegen: Polyphony Voice Count." This is coupled to the @polyphony
setting on the root rnbo~ object. Disable the configuration setting "Codegen: Link Polyphony to rnbo~" to choose a different polyphony value during export.
Setting polyphony to a non-zero value will set the maximum voice count, overriding any value set using the @polyphony
attribute. Non-zero polyphony will use the simple
voice controller for the root RNBO patcher. Note that this only affects the root RNBO patcher, and does not change the polyphony count or voice controller mode of polyphonic RNBO subpatchers.
User Polyphony
Each p RNBO subpatcher can have its own polyphonic behavior. Different subpatchers can have different polyphonic voice counts and also different voice controllers. Setting the @voicecontrol
attribute to user
disables automatic voice allocation for the RNBO subpatcher. In this case, RNBO provides tools for manual voice management.
The Mute and Target Messages
The mute
message allows individual voices to be muted/unmuted.
The target
message with a voice index value sets the subpatcher to route incoming values to the specific voice. The target
message with a zero value will cause incoming values to be received by all voices.
It is worth noting that since RNBO messages can be sample accurate, there is mostly no need to convert them into audio signals before sending them to the voices.
The Voicestatus Outlet
When @voicecontrol user
is enabled, RNBO will add an additional outlet. This voicestatus
outlet can be used to get updates about the mute status of each polyphonic voice.
This outlet will output a list like <voice_number> <mute_state>
whenever the mute status changes for a given voice. This can be used to implement your own voice controller with whatever behavior you like. For more information see Building a Custom Note Controller with Codebox.
Receive~ and @receivemode in Polyphonic Subpatchers
Polyphonic subpatchers can use send~ and receive~ to send audio to each other. However, each non-local voice has a delay of exactly one signal vector. To handle possible timing issues this can create, RNBO subpatchers have a @receivemode
attribute with two modes, local and compensated.
Local
By default, the local voice is not delayed while signals sent to all other voices are, which can cause the voices to be misaligned. This is because by default, polyphonic subpatchers in RNBO are set with @receivemode local
.
Compensated
When the subpatcher is set to [p @receivemode compensated]
, receive~ objects within the local voice will add one vector of delay to align them with the other voices. While this does introduce one signal vector of latency, it means that audio signals sent through a send~ are aligned between all polyphonic voices.