Programmatically removing parts of a preset

I’ve been thinking about sharing my humble custom units and presets.

In my own setup I use monome over i2c alot with my ER-301, so I have a lot of assignments of the .SC.TR and SC.CV units controlling units at the out most level. I figured that would at best annoy other users, or even worse, make the presets impossible to load, if users ER-301 doesn’t have those units enabled.

Ideally I’d like to write a python script that strips those from the .unit files. I did a quick test, and a diff of the two units (with and without the TR units), and it doesn’t seem very straight-forward to strip them out by means of code.

Any suggestions?

I attached the two tests (they don’t really do anything, just for testing)…
test clean.unit (5.0 KB)
test dirty.unit (6.4 KB)

2 Likes

I hope I understood you right in the other thread and don’t tip on your toes but I thought you want to share your presets also or more for ‘educational’ or learning by sharing purposes - so why not keeping the i2c connections in and show how you are using it, which monome apps/scripts you use and so on?

I would find that more interesting than just downloading other peoples custom units. But that might just be me.

I totally see what you mean. However, to me this is different, a bit like sharing units with assignments to various inputs. Not really a problem per se, but I would like to make the experience as clean as possible for the person trying to use the stuff…

I haven’t tried it yet, so not sure what would happen if I load a preset/unit that uses TR on an ER-301 that doesn’t have those enabled. I really should try this, but have been busy with other stuff, like soldering 0603 on the ADDAC manual latches and trying to solve a “problem” with a custom unit of mine…

Oh, and no toes stepped on :smiley:

1 Like

Thanks for your effort. I was curious about this myself. I can see the value of stripping out controls as very rarely would I expect my control scheme to match up with someone else (even with the TT ER-301 I2C combo).

Peeking inside the .unit file it looks like the SC.TR controls are in table:

["controlBranches"] = {
		["sync"] = {
			["units"] = { ... SC.TR ... };

I’m sure Brian or Joe can tell us if this breaks anything or not.

Could we programatically clear out everything found within the embedded “units” table? For Python and LUA it looks like there’s this: https://github.com/SirAnthony/slpp

I think I got it…

1 Like