Fundamentals
Polyphony and Voice Control
Export Targets
VST/AudioUnit
Max External Target
Raspberry Pi Target
The Web Export Target
The C++ Source Code Target
Code Export
Working with JavaScript
Working with C++
Patcher UI
Special Topics
Sample Accurate Patching
Scala and Custom Tuning
RNBO Raspberry Pi OSCQuery Runner
Raspberry Pi GPIO
Loading and Storing Presets
When you export a RNBO device, any Max snapshots on the rnbo~ object will be exported as well. These can be found attached to the presets key in the exported patcher JSON file.
When you export a RNBO device, any Max snapshots on the rnbo~ object will be exported as well. These can be found attached to the presets
key in the exported patcher JSON file.
Loading the Presets
After fetching the exported patcher JSON file, find any presets under the presets
key.
let patcherRaw = await fetch("patch.export.json");
let patcher = await patcherRaw.json();
let presets = patcher.presets || [];
if (presets.length < 1) {
console.log("No presets defined");
}
// Prints out a list of the patcher's presets
function loadPresetAtIndex(index) {
const preset = presets[index];
console.log(`Loading preset ${preset.name}`);
device.setPreset(preset.preset);
}
Creating a Preset
The RNBO device exposes a method getPreset
that returns the current state of the device as a loadable preset. You can use this to get a snapshot of the device. If you want to restore the device to its previous state, call setPreset
with the obtained snapshot.
let lastStoredPreset = [];
// An example method that stores the RNBO device's current preset
function storePreset() {
lastStoredPreset = device.getPreset();
}
// An example method that recalls the preset saved in storePreset
function recallPreset() {
device.setPreset(lastStoredPreset);
}