Patchbox OS (MODEP) Plugin Presets

Hello! finally I was able to make Plugin Presets work with the last Patchbox OS. For that I had to create a folder /home/modep/.lv2 and also add it to the LV2_PATH in the modep services to have the presets available after reboot. In case somebody is interested…

Before this, I tried to update the mod-ui and mod-host from moddevices but I was unsuccessful. I did several tests, but sometimes I have problems with permissions, or no inputs and outputs, and transport working with the patch user… Why there is a special user for modep?

Please let me know if somebody gets the new mod-ui and mod-host working…



It’s also possible to place your lv2s in /usr/modep/lv2.

So that the entire thing does not have to run as root, and is compatible with both Raspberry Pi OS and Patchbox OS variations :slight_smile: It really shouldn’t be an issue.

I was not able to place the plugins presets in /usr/modep/lv2, although the lv2 plugins are there.

Looks the plugin presets are forced to be saved in /home/(user)/.lv2 folder somewhere in the code, one folder for each preset, and if it doesn’t exist, then they are not saved. Which is not the same as the plugin folder defined in the LV2_PATH. Also the user running the mod-host (modep) should have write access to this folder.

The change in the LV2_PATH makes them aswell available after reboot… both paths should be defined there, the plugin folder and the plugin preset folder.

Copying to /usr/modep/lv2 should be done as root (using sudo cp). The LV2 plugins themselves are read-only, so the modep user only requires that permission to the lv2 folder.

Sorry Giedrius, I think I didn’t explain clearly… LV2 plugins themselves are ok like you said.

But what is not working out of the box is the LV2 plugin presets. This is a feature similar to pedal-board snapshots, but with the parameters of each plugin and also the midi learn assignations. For example with the Midi Step Sequencer you could save in different plugin presets some drum patterns, so you can easily change among them just selecting the preset and not each note of the sequencer.

This feature is already included in the web interface, but not working because of the folder and permissions commented before…

Ok, I see. Do you know if the location of stored presets can be changed? It’d be not conventional in Linux to store non-static information under /usr tree.

I think the location is forced somehow in the mod-host code to /home/(user)/.lv2, I didn’t find it in the code, but the path was shown in the mod-ui logger.

1 Like

@ferag how to do this? What file has to be edited, how to add a LV2_PATH? Thanks a lot!

You could just install the presets that MODEP should see into /usr/modep/lv2

Creating the /home/modep/.lv2 directory worked so far, the pedal/plugin presets now can be stored by the def preset_save_new from /usr/lib/python3/dist-packages/mod/ which calls a hidden directory in /home/modep/.lv2/ (~/.lv2/):

    def preset_save_new(self, instance, name, callback):
        instance_id  = self.mapper.get_id_without_creating(instance)
        pluginData   = self.plugins[instance_id]
        plugin_uri   = pluginData['uri']
        symbolname   = symbolify(name)[:32]
        presetbundle = os.path.expanduser("~/.lv2/%s-%s.lv2") % (instance.replace("/graph/","",1), symbolname)

        if os.path.exists(presetbundle):
            # if presetbundle already exists, generate a new random bundle path
            while True:
                presetbundle = os.path.expanduser("~/.lv2/%s-%s-%i.lv2" % (instance.replace("/graph/","",1), symbolname, randint(1,99999)))
                if os.path.exists(presetbundle):

        def add_bundle_callback(ok):
            # done
            preseturi = "file://%s.ttl" % os.path.join(presetbundle, symbolname)
            pluginData['preset'] = preseturi

                'ok'    : True,
                'bundle': presetbundle,
                'uri'   : preseturi

        def host_callback(ok):
            if not ok:
                    'ok': False,
            self.add_bundle(presetbundle, add_bundle_callback)

        self.send_notmodified("preset_save %d \"%s\" %s %s.ttl" % (instance_id,
                                                                   symbolname), host_callback, datatype='boolean')

I just don’t technically know how to add the LV2_PATH to the modep services like @ferag advises (for having the presets available after the reboot). Nor do I know why, just thought if @ferag needs it, I’ll need it to :joy:

Actually, the presets do load after reboot even without adding the LV2_PATH but it felt like missing something… Because, one thing that still doesn’t work is when saving a new preset it won’t load when clicking it after it shows up in the presets list. I first have to reload the mod-gui before beeing able to select a new preset.

You have to edit the .service files to change their environment variables. The .service files that are under /lib/systemd/... or /usr/lib/systemd/... are ones installed by .deb packages, but you may copy them into /etc, and your local files will override the ones that come from packages. So to change LV2_PATH for the mod-host and the mod-ui, do this:

# Make override copies
sudo cp /lib/systemd/system/modep-mod-host.service /etc/systemd/system/
sudo cp /lib/systemd/system/modep-mod-ui.service /etc/systemd/system/

# Edit each file
sudo nano /etc/systemd/system/modep-mod-host.service
sudo nano /etc/systemd/system/modep-mod-ui.service

You have to change the line:


Into something like:


for both services.

Then make systemd aware of the config changes and restart the services:

sudo systemctl daemon-reload
sudo systemctl stop modep-mod-host modep-mod-ui
sudo systemctl start modep-mod-host modep-mod-ui
1 Like

:joy: I’ve lost all data now, no pedalboard gets loaded, no more plugins show up, no presets. I guess I did something wrong. Trying to recover this.

1 Like

In the worst case, you may remove the files you created in /etc/ and start over :slight_smile:

These commands may be helpful to look for any warnings/errors printed internally by the services:

journalctl -u modep-mod-host -f
journalctl -u modep-mod-ui -f
1 Like

Actually it might be my mistake - the separator is probably : instead of ;

The : separator fixed it. :sweat_smile:
@Giedrius Thank you so much!

1 Like

I’ve edited my little guide to fix the mistake :slight_smile:

1 Like

Sorry, this was my mistake, dont’ bother.

To resume, you can fix the pedal/plugin presets like this:

sudo mkdir /home/modep
sudo chmod 777 /home/modep
sudo mkdir /home/modep/.lv2
sudo chmod 777 /home/modep/.lv2

With this, all presets can correctly be created, edited and selected.

1 Like