Learn Loading and Storing Presets

Getting Started

Welcome to RNBO

Quickstart

RNBO Basics

Key Differences

Why We Made RNBO

Fundamentals

Audio IO

Messages to rnbo~

Using Parameters

MIDI in RNBO

Messages and Ports

Polyphony and Voice Control

Audio Files in RNBO

Using Buffers

Using the FFT

Export Targets

Export Targets Overview

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++

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);
}