Fundamentals
Export Targets
Code Export
Patcher UI
Special Topics
RNBO Raspberry Pi OSCQuery Runner
MIDI in RNBO
Specific details on how to utilize MIDI inside of RNBO, including both internal and external use.
MIDI is one of the communication methods that you can use to control your RNBO patches. If you're already familiar with using MIDI in Max, the implementation is very similar in RNBO.
Adding MIDI Input
To enable MIDI input you must have one or more MIDI input objects in your patcher. Once a MIDI input object is created, the patcher creates a special MIDI inlet for receiving MIDI messages. In the rnbo~ object, this inlet will always be the right-most inlet, regardless of the total number of inlets.
MIDI that is received by the rnbo~ object is automatically passed to all MIDI input objects anywhere in the rnbo~ patch and its subpatches.
When exported, MIDI input objects allow the exported code to receive incoming MIDI messages from the target platform.
The MIDI input objects supported by RNBO are:
- midiin for receiving raw midi data;
- ctlin for receiving continuous controller messages;
- bendin for receiving MIDI pitch bend messages;
- notein for receiving MIDI note messages; and
- sysexin for receiving system-exclusive MIDI messages.
- touchin for MIDI channel pressure input; and
- pgmin for MIDI Program change input.
All inbound and outbound midi messages are available to RNBO subpatchers. This means that midiin and midiout objects inside RNBO sub patches can send and receive midi directly without needing to be connected to the parent patcher.
Adding MIDI Output
To enable MIDI output you must have one or more MIDI output objects in your patcher. Once a MIDI output object is created, the patcher creates a special MIDI outlet for sending MIDI messages. In the rnbo~ object, this outlet will always be the second from the right-most outlet, regardless of the total number of outlets.
When exported, MIDI output objects expose outgoing MIDI messages in the exported code.
The MIDI output objects supported by RNBO are:
- midiout for outputting raw midi data;
- ctlout for outputting continuous controller messages;
- bendout for outputting MIDI pitch bend messages;
- noteout for outputting MIDI note messages; and
- sysexout for outputting MIDI system-exclusive messages.
- touchout for MIDI channel pressure output; and
- pgmout for MIDI Program change output.
Connecting your controller
Make a midiin object in the top-level Max patcher and connect it to the right-most inlet of the rnbo~ object - the midi inlet. Double click the midiin object and select your connected midi input device. You can use print to check the incoming MIDI stream.
Controlling parameters with MIDI
Use any of the MIDI input objects alongside the set object to control a parameter inside any RNBO subpatcher that contains a parameter that you want to modulate. The scale object can be used to scale the MIDI input range to the parameter's range. If you want to assign a midi cc to something like a filter cut off it's a good idea to add some exponential scaling since the frequency range isn't linear. You can add an exponent to the scale object as the last argument or into its rightmost inlet.
If your controller supports polyphonic aftertouch you can use the polyin object in a similar way to the ctrlin object, the middle outlet outputs the midi note number and the left outlet outputs the aftertouch value.
MIDI in the RNBO environment
The MIDI object family in RNBO is very similar to the objects found in Max, with the important distinction that you cannot directly specify a MIDI port. MIDI port selection must be handled by the target platform before being sent to the rnbo~ object, where it is simply parsed in the RNBO patcher code.