Forums > MaxMSP

Saving MatrixCtrl States

June 5, 2006 | 7:07 pm

Hi All,

I’ve been really struggling here to make something, maybe someone can help.

I’ve been working on a set-up that needs to be able to remember the state of a MATRIXCTRL. The complication is that the MATRIXCTRL is 64 X 128 (it’s a 64 step sequencer). It seems that everywhere I turn for this, there is an obstacle… PATTR and it’s friends have a limit to numbers, as does COLL.

When I use ‘getcolumn’ in this set up, because it’s 64 X 128, I end up with 8192 zeros and ones. The only thing I can think of is to maybe store EACH column from the matrix to a different location in coll, but that makes things very complicated, as I’m hoping to be able to save presets with coll.

Any ideas?

Cheers,
Joel

PS. My Max/MSPness is fairly beginnerish, so apologies if there is an obvious solution.


June 5, 2006 | 10:41 pm

Sorry to say, the solution is actually dead-obvious — the preset object saves matrixctrl states.

Evan


June 6, 2006 | 9:05 am

Hi,

The solution bellow saves only the points which are enable in a
message box (or what ever, event a pattr object). If you exceed the
actual 4094 atoms limitation, you can split that in two message boxes.

HTH,
ej

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#N vpatcher 343 346 522 576;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 50 127 49 196617 append 1;
#P newex 50 102 47 196617 zl iter 2;
#P newex 50 79 75 196617 t l clear;
#P newex 50 50 86 196617 r matrix-in;
#B color 6;
#P outlet 115 186 15 0;
#P connect 1 0 2 0;
#P connect 2 0 3 0;
#P connect 3 0 4 0;
#P connect 4 0 0 0;
#P connect 2 1 0 0;
#P pop;
#P newobj 172 90 80 196617 p Matrix-recall;
#B color 5;
#P window linecount 2;
#P message 377 171 330 196617 ; matrix-in 1 0 2 4 2 7 4 0 4 7 5 0 5
4 6 4 7 0 8 0 9 7 10 0 10 4 12 0;
#P button 377 124 15 0;
#P window linecount 1;
#N vpatcher 342 80 910 608;
#P origin 0 10;
#P window setfont "Sans Serif" 9.;
#P comment 160 430 324 196617 if you have more than 256 enabled
points use [mxj list.Group] instead;
#P comment 316 378 211 196617 filter to get the x and y of the
enabled points;
#P comment 161 63 242 196617 get the row 0 to know how many columns
you have;
#P window linecount 0;
#P newex 89 454 122 196617 prepend set \; matrix-in;
#P newex 104 260 101 196617 grab 2 matrix-memo;
#P message 49 67 68 196617 getrow 0;
#P newex 49 89 108 196617 grab 2 matrix-memo;
#N comlet to message box;
#P outlet 89 484 15 0;
#N comlet bang_config;
#P inlet 49 42 15 0;
#P newex 74 145 40 196617 uzi;
#P newex 195 309 52 196617 listfunnel;
#P newex 104 168 27 196617 – 1;
#P newex 104 191 79 196617 t i i;
#P newex 195 345 186 196617 pack 0 0 0;
#P message 104 240 68 196617 getcolumn $1;
#P newex 89 426 67 196617 zl group 256;
#P newex 195 376 117 196617 if $i2 == 1 then $i3 $i1;
#P newex 74 121 50 196617 zl len;
#P comment 134 124 178 196617 if > 256 use [mxj list.Length] instead;
#P connect 10 0 13 0;
#P connect 13 0 12 0;
#P fasten 12 1 1 0 152 113 79 113;
#P connect 1 0 9 0;
#P connect 9 1 3 0;
#P connect 2 0 3 0;
#P connect 3 0 15 0;
#P connect 15 0 11 0;
#P connect 9 2 7 0;
#P connect 7 0 6 0;
#P connect 6 0 4 0;
#P connect 4 0 14 0;
#P connect 14 1 8 0;
#P connect 8 0 5 0;
#P connect 5 0 2 0;
#P fasten 6 1 5 2 178 219 376 219;
#P pop;
#P newobj 377 148 76 196617 p mem_matrix;
#B color 5;
#P newex 85 90 80 196617 r matrix-memo;
#B color 6;
#P user matrixctrl 85 119 226 146 MatrixDefaultCell.pct
MatrixDefaultBkgnd.pct 226 146 16 16 14 9 16 16 1 1 48 2 5120 0;
#P connect 1 0 0 0;
#P connect 5 0 0 0;
#P connect 3 0 2 0;
#P connect 2 0 4 0;
#P window clipboard copycount 6;


June 6, 2006 | 10:40 am

Not sure if I fully understand what you’re doing, but
if you’re using the row values to represent notes, why
not use the matrixctrl in dial mode instead ? ie.
Instead of representing your note values by rows,
represent them by dial/slider position. Your
matrixctrl then only needs to be 1 x 64 (or 4 x 16 or
whatever).
I just happen to have started working on a 64 step
sequencer recently that does exactly that.
The downside to using this approach is that if you
really do need 128 note precision, you’d have to build
a 128 state graphic for the matrixctrl; how good are
you at automating Photshop…?
cheers
Roger


June 6, 2006 | 1:44 pm

Hey All,

Thanks for your assistance.

Evan, I’ve found the Preset object a bit flakey, I tend to not trust it. I’ve had it drop info… sorry I should have mentioned it.

Emmanuel, your solution looks great… let me just see if it works when the matrix is so huge.

Roger… I don’t think I know what dial mode is. Can you explain that?

The way that I am ulitmately using it, is to have the ability to drag and drop a MIDI sequence onto the matrix and to have it display the sequence without rests, so just notes. But I do need it to be polyphonic and compatible with any MIDI file that is under 64 steps. I’ve managed to accomplish it all except saving it’s state.

Anyway, if you all have more ideas, let me know!

Thanks so much,
Joel


June 6, 2006 | 3:31 pm

That would be because it’s somehow escaped
documentation.
There was some discussion about it recently at
http://tinyurl.com/quy32 – you have scroll down the
thread a bit.
Basically, matrixctrls can have more than just 2
states, so they can behave as sliders or dials; you
need to send the matrixctrl a dialmode 1 message, and
a dialtracking [int] message to set the sensitivity.
You also need to make multi-state matrixctrl graphics;
I posted a link to a few examples on the thread
mentioned above,
cheers
Roger


June 6, 2006 | 9:27 pm

Hi.

Id also be very interested in this….

Would u have a link to a patcher-example or sth. ? Unfortunately, I
cant find "examples" in the thread u mentioned, "only" screenshots.

Any help or advice would be very nice ;-) and greatly appreciated!

(e.g. settings of pictures-size, is remote-controlling (msgs)
possible ? etc. -> Ive been trying it myself with the default
matrixctrl pictures, but max crashed…. and unfortunately almost no
docu/help about this topic)

cheers.
m


June 7, 2006 | 11:04 am

The examples are at http://www.wildfrontear.co.uk/mctl
stuff.1.zip (it was in the last post of the thread).
I’ve added a higher precision version of the slider
and a 5 octave vertical keyslider.
There is some info on dial mode, as pointed out by
Jhno (also in the thread!) in the PictureFormat
sub-patch in matrixctrl.help,
cheers
Roger


Viewing 8 posts - 1 through 8 (of 8 total)