Lemur Switches to Matrixctrl

Feb 12, 2008 at 7:06am

Lemur Switches to Matrixctrl

Hello all

this is a small patch i wrote to convert switches info from a lemur to a max matrixctrl object.

The switch object is a grid of button sending a list of 0 and 1 values, corresponding to the state of each button. (4 x 4 switches = array of 16 numbers etc…)

The 2 arguments of my object are the dimensions of the switch array (x and y)

For some reason, it’s working fine up to 9 x 9 switches, but gives a list formatting error when you reach 10 x 10 switch.

I can’t figure why.

Any ideas would be welcome !

Thanks in advance.

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 247 86 30 196617 t b b;
#P newex 247 55 48 196617 loadbang;
#P newex 233 342 96 196617 expr $i1 * $i2 * 3;
#P newex 194 247 27 196617 – 1;
#P message 194 218 21 196617 $2;
#P newex 195 175 27 196617 – 1;
#P message 195 139 21 196617 $1;
#P newex 73 82 27 196617 t l b;
#N counter 0 0 3;
#X flags 0 0;
#P newobj 73 280 82 196617 counter 0 0 3;
#P newex 73 248 32 196617 sel 0;
#P newex 50 346 57 196617 pack 0 0 0;
#N counter 0 0 3;
#X flags 0 0;
#P newobj 73 213 81 196617 counter 0 0 3;
#P newex 50 389 61 196617 zl group 48;
#P newex 73 50 55 196617 vexpr $i1;
#P newex 73 119 24 196617 iter;
#P newex 73 148 27 196617 t b i;
#P inlet 73 30 15 0;
#P outlet 50 411 15 0;
#P connect 13 0 14 0;
#P fasten 13 0 15 1 199 240 324 240;
#P connect 16 0 17 0;
#P fasten 11 0 15 0 200 165 238 165;
#P connect 11 0 12 0;
#P fasten 17 0 11 0 252 130 200 130;
#P fasten 17 1 13 0 272 210 199 210;
#P fasten 14 0 9 4 199 273 150 273;
#P fasten 12 0 6 4 200 203 146 203;
#P fasten 15 0 5 1 238 380 106 380;
#P fasten 2 1 7 2 95 180 163 180 163 321 101 321;
#P fasten 9 0 7 1 78 304 78 304;
#P connect 8 0 9 0;
#P fasten 6 0 7 0 78 236 55 236;
#P connect 6 0 8 0;
#P connect 2 0 6 0;
#P connect 3 0 2 0;
#P connect 10 0 3 0;
#P connect 4 0 10 0;
#P connect 1 0 4 0;
#P connect 5 0 0 0;
#P fasten 10 1 5 0 95 110 175 110 175 375 55 375;
#P connect 7 0 5 0;
#P window clipboard copycount 18;

#35773
Feb 12, 2008 at 7:46am

#122348
Feb 12, 2008 at 2:52pm

Hi, thanks for your reply

Unfortunately your abstraction doesn’t seem to work either ;-)

Somebody on JM forum suggested it could be a limitation of the zl group object (max 300 value at once ?), but i can’t find any mention of this in the manuals…

I’ll try another approach then…

Ph

#122349
Feb 12, 2008 at 3:22pm

#122350
Feb 13, 2008 at 8:26am

#122351
Apr 24, 2013 at 6:10pm

Hello, I’m having trouble with this same issue.

Lemur ‘Switches’ output a list of on/off values the length being the number of switches.
A 2×2 switch matrix with only the first switch ‘on’ therefore outputs: 1 0 0 0. There is not differentiation between rows/cols.
I would like to use this list to turn on the corresponding buttons on a MatricCtrl object of the same size..

I have tried all manner of funneling and unpacking and repacking and attempts to modulo.
This is frustrating as I know it is simple and can imagine doing it very quickly in text code.

For the sake of conversation, posting one iteration below – *this doesn’t work and is not how to accomplish what I want* – (and it may seem crazed!).

– Pasted Max Patch, click to expand. –
#122352
Apr 24, 2013 at 7:07pm

This is a strange way to do it but I think it does what you need:

– Pasted Max Patch, click to expand. –
#122353
Apr 24, 2013 at 7:23pm

Edit:
Here’s a better version without the cellbock:

– Pasted Max Patch, click to expand. –
#122354
Apr 24, 2013 at 7:29pm

Haha another version with even less objects:

– Pasted Max Patch, click to expand. –
#122355
Apr 24, 2013 at 9:55pm

hehe, I like using Jitter for this. Brave!

Here’s a “normal” way of doing it. This can easily be abstracted by the way, so you just specify the size of the matrix you’re filling.

– Pasted Max Patch, click to expand. –
#122356
Apr 24, 2013 at 10:07pm

Wetterberg: Ah that’s better indeed, I’ve been doing way too much Jitter lately :P

#122357
Apr 24, 2013 at 10:28pm

There is no such thing as too much Jitter!!! :-D

#122358
Apr 25, 2013 at 3:55am

Thanks, Guys! Will give ‘em all a shot.
Have a good night, day and the rest.

#122359
Apr 25, 2013 at 6:34am

As an aside, do note that if you’re building a sequencer, then matrixctl isn’t really ideal, at least in my opinion.

Slicing the list up (with zl slice 16, for instance) and feeding it to live.step in mode 4 is what I’m building in right now, it’s really powerful.

#122360

You must be logged in to reply to this topic.