I suggest checking out the Electro-Smith Daisy Patch module:

https://www.electro-smith.com/daisy/patch

"Custom firmware files can be created using Pure Data, Arduino, Max/MSP ~gen, or C++."

Could be perfect for algorithmic music generation on modular. I haven't tried it yet though - have one coming but it seems like it's caught in an endless loop in the Oz postal system after riding over from the US on the back of a sea turtle (not Electro-Smith's fault).