MODEP toggle bypass with one MIDI event

Hi all,

First of all - so glad I’ve found this project, it is pretty much everything I wanted in an open source multi-effects system that runs on RPi. In my case, I’m running it all in my “yellow box” that I made which also includes a few footpedal buttons: Guitarix Pedal | Doug’s Blog

Setting up patchbox + MODEP is the third iteration of OS/system that I’ve put on this thing, and is by far the most pleasing to use, and most stable in terms of it’s DSP performance.

I have just one issue - it doesn’t seem possible to implement the footpedal buttons as a dumb controller which can be mapped to effect unit bypass controls?

I am able to write the software to interface the buttons/GPIO to any MIDI or OSC messages that I want - however in my mind, this software should be completely stateless - it cannot know what the value of each effect bypass is at all times - because the pedalboard or snapshot might change at any time under the control of MODEP, and the control mappings between pedalboards can also completely change.

Therefore, the button controller software can only emit the same message each time each button is pressed. And there doesn’t seem to be any way for MODEP to understand this message as an instruction to simply toggle a bypass?

My intended use for the buttons I have available are as follows:

  • Top left: some sort of system function TBC
  • Left to right : Prev pedalboard or snapshot, Bypass 1, Bypass 2, Bypass 2, Next pedalboard or snapshot

Is there a way I can get this to work?


I think what you want to do is look at the API available in MODEP, specifically the IP API. What that requires is you have to either start another mod host or turn off the default modui. Then you can interact with mod the way you’re wanting to.

I’m actually after doing the complete opposite of this. I really don’t want to write anything MOD specific, I should be able to control bypass switches with any MIDI remote push-button controller, no?

Correct. You can attach a MIDI event to any plugin parameter in MODEP.

Sort of. When you have a push-button controller, this doesn’t work. The bypass switches work only on CC controls where 0x00-0x3f = OFF and 0x40-0x7f = ON. Usually, push-buttons are not latching, they don’t have a concept of on-off state, and it’s not useful to have to keep the button pressed down either to keep the effect turned on.

So, I am curious as to how to get toggling to work in MODEP? It seems a huge oversight that this is not supported, given the very strong “Pedalboard” paradigm of the software and how guitar pedalboards are normally used with foot-control push buttons?

So are you talking about a SPST or SPDT footswitch? When I built my custom controller I used SPST switches. For each switch I also added an LED that I toggle on/off every time the footswitch is pressed. Now to your point, if the control in MODEP is “on” by default and the LED is off (because the LEDs are all set to “Off” when the controller boots), pressing the footswitch will send the CC to MODEP, turning the control “Off” but then the LED is on. So to keep this simple, I generally only use a footswitch if I want to turn something “On” that in MODEP is normally “Off”. I realize that might not work for everyone but I suppose you could work around that by having the software that drives the controller default an LED to “On” if the control in MODEP defaults to “On”. Downside is if you change that you’d have to also remember to change that in the controller.

I think this is why devices like pi-stomp are so attractive. It interfaces with MODEP directly and can turn on the LED if the corresponding control in MODEP is on.

I have considered re-writing the code in my custom controller to use mod host API so that the LED could be turned on if the control in MODEP was also on.

Correct, I am using SPST switches (momentary, stomp-box type). The controller software can do one of two things with these:

  1. maintain an internal on/off state, and toggle that when the button is pressed (rising edge, assuming active high logic), and then emit alternating messages
  2. simply emit a static message on the rising edge and maintain no state

I definitely prefer #2 - because the state is already maintained by MODEP and the plugins, I do not wish to have to make any assumptions about the startup state of either MODEP, the plugin, or the controller.

So, to my point here - MODEP doesn’t support at all any toggle mode for binary (on/off) plugin parameters? IMO it really should, because doing anything else really makes the state synchronisation incredibly difficult.


Okay, so your last paragraph is what I think we need to focus on here and perhaps I’m not understanding your question. Let’s take an example: I have a “fuzz” pedal on my MODEP pedalboard that is normally “Off”. I mapped a MIDI CC to one of the buttons on my custom controller. When that button is pressed, the controller determines that the LED is “Off” so it sends a MIDI message over USB with modulation set to 127. So that means “Turn it on”. If the pedal was already on for some reason, this in effect does nothing. Now if I press the footswitch again, the controller sees that the LED is “On” so it send a MIDI message over USB with modulation set to 0 (turn it “Off”).

And maybe this is where your question lies: how do I send a MIDI CC to MODEP without a modulation and just have MODEP determine if the associated parameter should be toggled on/off? You mention that state synchronization could be difficult and I agree, it would, but in practice for me it’s hardly noticeable. Now take that with a grain of salt. I’m a bass player. So I’m certainly not changing my pedalboard up with the frequency that a guitar player might need.

Yup, I agree with your summary - if everything is set up and doesn’t change much, then you can predict a system startup and know that every button works on the first press.

For me though, the benefit of using MODEP (or any software effects emulation) is to entirely swap out pedalboards at a convenient point, and when doing so, that may be in a state that is different from what the controller thinks. Therefore there’s a 50/50 chance that any button push simply does nothing, which is not really what you want to happen mid-performance, most usually at a musically critical moment. If the pedalboard is to be always fixed, then I may as well invest in a real hardware pedalboard and not at all use a software emulation?

There is another solution - one can make the controller stateful (remembers on/off state) so long as MODEP sends messages back out to the controller when the mapped parameters change on the MODEP side. In that setup, I can ensure that the controller starts up first, and when MODEP comes online it’ll send all the states to the controller and from then on everything is in sync. This would also need to happen when snapshots or pedalboards change, or parameters are changed from the UI, for example.

Apologies to all if this thread sounds kinda negative from my side; I’m really keen to get to the bottom of this, because if I can achieve this kind of control I will likely invest more time in this setup and commit to using it seriously.

If anyone knows the areas of MODEP code that I could dig into to look at a toggle implementation, I am also willing to try and actually implement it, and share that back to the community.

I’ve also just seen this from another thread here:

I will look into how their buttons are implemented.

I think you’ll want to review the docs of mod-host and using their socket API:

I’ve got some success just using the pi-stomp software. I’ve had to change out a few things because it makes assumptions about what peripherals are attached:

  • stubbed out all LCD hardware
  • changed config yml file, disable rotary encoders, map buttons to my own GPIOs

I’ll need to do more work to map buttons to pedalboard changes and/or other system functions as I don’t have the rotary encoders. But, I do have the buttons mapped to pedal bypasses now.


I somewhat hijacked a pi-stomp forum thread about what I’m doing here: Using the RPi "Official" 7" Touchscreen?

I’ll probably continue to use my hacked up version for the time being, to avoid getting too side-tracked and keep on topic of making music with the device :slight_smile:

1 Like


I looked into using modep like this and gave up

There is a lot of latency in the python/ web interface. It is nowhere near realitime

Best to talk directly to mod-host

Maybe write a programme to convert midi to mod-host param_set commands.

I have done almost that. I am using jack in that way