Matrixctrl -> Coll -> Matrixctrl

Steven's icon

Hi,

I wonder if anyone can help me out, my brain stopped functioning.
The patch attached below stores a matrixctrl's current values as a coll, row for row.

But what I can't figure out is how to make the coll output into a form that can be used to repopulate a matrixctrl again.

I've tried some haphazard combinations of iter and trigger but I'm terrible at this recursive/iterating type stuff..

Anyone help me?

Thanks

Max Patch
Copy patch and select New From Clipboard in Max.

Samuel Freeman's icon

this seems to work:

Max Patch
Copy patch and select New From Clipboard in Max.

On 04/01/2008, Steven Taylor wrote:
>
> Hi,
>
> I wonder if anyone can help me out, my brain stopped functioning.
> The patch attached below stores a matrixctrl's current values as a coll, row for row.
>
> But what I can't figure out is how to make the coll output into a form that can be used to repopulate a matrixctrl again.
>
> I've tried some haphazard combinations of iter and trigger but I'm terrible at this recursive/iterating type stuff..
>
> Anyone help me?
>
> Thanks
>
> S
>
> max v2;
> #N vpatcher 10 59 546 658;
> #P origin 0 89;
> #P user matrixctrl 260 481 130 67 MatrixDefaultCell.pct MatrixDefaultBkgnd.pct 130 67 16 16 8 4 16 16 1 1 48 2 5120 0;
> #P window setfont "Sans Serif" 14.;
> #P window linecount 1;
> #P comment 312 197 145 196622 Click to output Coll;
> #P window setfont "Sans Serif" 9.;
> #P message 134 330 33 196617 clear;
> #P newex 193 403 32 196617 print;
> #P message 335 266 14 196617 0;
> #P button 312 222 15 0;
> #P newex 312 245 40 196617 uzi 4;
> #N counter 0 1 4;
> #X flags 0 0;
> #P newobj 312 288 71 196617 counter 0 1 4;
> #P message 197 306 39 196617 set $1;
> #P message 55 108 14 196617 0;
> #P newex 197 333 45 196617 prepend;
> #N coll ;
> #P newobj 197 357 53 196617 coll;
> #P message 32 156 57 196617 getrow $1;
> #P button 31 61 15 0;
> #P newex 32 87 40 196617 uzi 4;
> #N counter 0 0 3;
> #X flags 0 0;
> #P newobj 32 130 71 196617 counter 0 0 3;
> #P user matrixctrl 34 183 130 67 MatrixDefaultCell.pct MatrixDefaultBkgnd.pct 130 67 16 16 8 4 16 16 1 1 48 2 5120 0;
> #P window setfont "Sans Serif" 14.;
> #P comment 31 37 135 196622 Click to store Coll;
> #P connect 4 0 3 0;
> #P connect 3 0 2 0;
> #P connect 2 0 5 0;
> #P connect 5 0 1 0;
> #P connect 3 1 8 0;
> #P connect 8 0 2 2;
> #P connect 6 0 14 0;
> #P connect 2 0 9 0;
> #P connect 1 1 7 0;
> #P connect 9 0 7 0;
> #P connect 10 0 6 0;
> #P connect 15 0 6 0;
> #P connect 7 0 6 0;
> #P connect 12 0 11 0;
> #P connect 11 0 10 0;
> #P connect 11 1 13 0;
> #P connect 13 0 10 2;
> #P pop;
>

Steven's icon

Ah brilliant thanks, I was so close yet so far!

Chris Muir's icon

At 9:40 AM -0700 1/4/08, Steven Taylor wrote:
>I wonder if anyone can help me out, my brain stopped functioning.
>The patch attached below stores a matrixctrl's current values as a coll, row for row.
>
>But what I can't figure out is how to make the coll output into a form that can be used to repopulate a matrixctrl again.
>
>I've tried some haphazard combinations of iter and trigger but I'm terrible at this recursive/iterating type stuff..

No recursion involved, just a couple of counts: one for row, and one for column. I took the liberty of removing the counters you did have and using Uzi's count output.

Max Patch
Copy patch and select New From Clipboard in Max.

--
Chris Muir | "There are many futures and only one status quo.
cbm@well.com | This is why conservatives mostly agree,
http://www.xfade.com | and radicals always argue." - Brian Eno

Emmanuel Jourdan's icon

On 5 janv. 08, at 06:35, Chris Muir wrote:

> No recursion involved, just a couple of counts: one for row, and one
> for column. I took the liberty of removing the counters you did have
> and using Uzi's count output.

I'll add my version ;-) Using uzi second argument to define the
starting index, and listfunnel to get pairs of {index, value}.

ej

Max Patch
Copy patch and select New From Clipboard in Max.

Chris Muir's icon

At 11:51 AM +0100 1/5/08, Emmanuel Jourdan wrote:
>I'll add my version ;-) Using uzi second argument to define the starting index, and listfunnel to get pairs of {index, value}.

I always forget about listfunnel, until I see an example for which it is perfect.

Thanks,
Chris

--
Chris Muir | "There are many futures and only one status quo.
cbm@well.com | This is why conservatives mostly agree,
http://www.xfade.com | and radicals always argue." - Brian Eno

Stefan Tiedje's icon

Emmanuel Jourdan schrieb:
> I'll add my version ;-) Using uzi second argument to define the starting
> index, and listfunnel to get pairs of {index, value}.

my version would get rid of another uzi and use dump... ;-)

Max Patch
Copy patch and select New From Clipboard in Max.

--
Stefan Tiedje------------x-------
--_____-----------|--------------
--(_|_ ----|-----|-----()-------
-- _|_)----|-----()--------------
----------()--------www.ccmix.com

Steven's icon

Thanks everyone, it's brilliant to see various ways to approach it... all boiled down to a very efficient solution.

seejayjames's icon

good examples... but out of curiosity... why coll and not preset or pattr for your matrixctrl? they work real easy to save matrix states too. plus if your matrix has more levels than 0 and 1 you can interpolate (if they are volume levels, for example).

listfunnel has been really really handy for stuff like this in the past, that's for sure. For multi-level iteration experiment with stringing two Uzi's together, it's basically a nested For loop. Can be very handy for reading / repopulating arrays.

--CJ

Steven's icon

Hi CJ,

Im working on monome patches so they will only be storing 0s and 1's, so morphing isn't important in this case... although I was also considering adding seperate layers of midi cc controller data down the line so I'll have to think about whether pattr might be a better overall solution.

But I figured a coll could give me more flexibility with manipulating the simple patterns. I'm storing multiple patterns within a single coll by offsetting the index number... as I thought I could start doing stuff like grabbing rows/columns from different patterns to create new ones on the fly.

Steven's icon

Actually can anyone tell me what the limit for data storage in a coll is?

seejayjames's icon

Ah, gotcha. Then be sure to check out several other goodies: mtr records matrixctrl, with just one track (as I recall) so you can play back the generation / manipulation of your patterns. With just one track of the mtr, too, you can play it back at any speed by using "next" and a delay factor instead of just "play", with a small bit of fiddling. Very cool stuff, and of course the speed is adjustable in real-time.

Also zl rot is great for rows and columns, to provide equal-but-rotated versions of your patterns. For beats this will do offsets / syncopations, and for pitches it would do transposition (kind of). Interesting stuff can be derived this way, and of course you can "mtr" the zl rot rotation amount, or randomize it, or cycle it, etc.

I've also found a system of filling the rows (or columns if you like) with equal-spaced beats automatically to be very helpful, for testing as well as for performance. Simplest way I found is to use uzi # (total # of beats across if filling rows) --> % 4 (mod # = how often you want a beat filled, in this case every 4) --> sel 0 (means the mod is 0) --> fill beat. So you can easily (say) fill a row every 4 beats, or just as easily, switch the beat on or off, or fill all the OTHER beats. etc.... etc... Have a drop-down for the mod # for each row, preset the dropdowns, and you can have all kinds of patterns generated with one click. And you can mtr the preset #.... ok, you get the idea ;)

Another thing: try *scripting* the matrixctrl: send messages to thispatcher to increase the size (height and width). The matrixctrl is quite special in that instead of scaling its size, it adds rows and columns based on its size! So... your user could have a 16 X 8 grid, or a 32 X 2, or a 4 X 16, etc... I suppose if the monome is a static size, then this might not be as useful, but being able to make subsets of the overall grid could be interesting. Of course, screen space can be an issue here.

Finally don't forget that you can do lots of this stuff with jitter matrices too, and especially if you're going to want cc data, there's a heck of a lot you can do with generating new patterns and values through jit.op, jit.brcosa, jit.bfg, etc... so you could use generated or pre-recorded video material to make your data (it would be output as a single luminosity 0-255 value per cell, scaled to 0-127 for cc), at the right resolution (grid-size) for the monome or whatever you want. Endless possibilities... now your music is directly related to the video you're using, and the effects you apply to it!

Have fun... CJ

Steven's icon

Wow Cj. I think the information in your reply may dominate the next few weeks of my life :)

I've always loved Max but have never connected with it for anything other than short bursts. But actually working with a fixed platform like the Monome, instead of having a completely blank canvas, has been actually very liberating for me.

And with Max 5 looming things are looking sunny :)

seejayjames's icon

yeah, it's pretty endless and addictive.... and Max 5 is gonna rock!

you're right about the fixed platform, or having restirictions in general: since you really can do just about anything, at some point you need to trim away the possibilities and get "deep and narrow" instead of "shallow and broad". Then you can get to a point where you've got something a lot more custom and unique. If you design it well you'll be able to reuse a lot of it in other projects, but there'll always be needs to re-create stuff, so as long as you're not *always* re-creating, I think that's fine.

Lots of ways to approach development and design of this stuff... I tend to be more tangential and experimental, which is great for expanding possibilities, but bad in that I re-build stuff all the time. I'd say take more time at the start to make something like your matrixctrl really fleshed-out, then use it every time you need it again, with small tweaks if needed. The same goes for lots and lots of modular parts of your patches: sometimes it's better to use existing stuff, other times it's just as quick to make it from scratch, especially if you can't find where you put the dang thing...

On that note I'd have a folder where you just keep patches that have little "bits" of stuff that don't do anything outside their own little world, and can just be copied and re-used, or used as bpatchers. Examples: a color swatch with saturation, a matrixctrl with some generation settings, a recordable range bar, pairs of numbers with min / max controls, a movie-player with some speed / resolution controls, etc. If you take the time to make these compact and nice-looking, you won't have to do it again and again. Worth the time up front.

--CJ