MIDI and many small sub-patches

Hi all,

I am slowly learning the value of “smaller sub patches / gen sub patches.” In learning how to break these down more and more I was wondering: Is this wise to do for MIDI I/O?

Example: I plan to create a set of MIDI CC messages that come into the device that will emulate (and/or be an alternative) to the hardware controls. For example if I had 8 buttons and I wanted to use the MIDI functions to decode CC messages would it be better to just create one function to decode the 8 button presses and send the data out, or one per button? Moreover, as I add CC messages for inbound functions do I just keep the one MIDI in function or break them up into smaller parts?

My initial thoughts has been: use one function because of the MIDI input… but I also recall reading a thread by @grrrwaaa where it was noted to break things into smaller parts for better perf, especially because of hardware branch prediction.

Not sure how much impact this would have on MIDI, but overall I’m trying to teach myself how to build much smaller layered blocks in GEN so that, where possible, the hardware prediction and all up hardware capabilities could maximize the performance.

In full disclosure :slight_smile: … currently my prototype really does need to be broken down better and I’m starting to figure that out as I go. Thus, I figured if MIDI is my next thing to bring online, may as well start to think in smaller pieces.

Any thoughts are greatly welcome.


If you’re using the dev branch of oopsy, there’s dedicated param names available for midi CC’s etc., e.g. [param midi_cc10]. That will make things way easier than using the midi parsing subpatcher, and probably more efficient. See doc here: MIDI Input · electro-smith/oopsy Wiki · GitHub

The tip about breaking things into smaller parts is more about avoiding the overhead of if() statements.

Otherwise breaking things into subpatchers has no effect at all on performance, but may help you to organize the patch :slight_smile:


Thank you for the information.