Easiest way to fill matrixctrl with random values?

Dec 3, 2008 at 8:09pm

Easiest way to fill matrixctrl with random values?

The title says it all: What is the easiest/fastest way to fill matrixctrl with random values (0s and 1s)?

I have come so far as to guess that “decide” can be used in some way or another, but would I have to make a list?

#41174
Dec 3, 2008 at 8:17pm

I’d use jit.noise and add a little scaling voodoo.
Your mileage may vary, what with being up north
and all. :-)

#146380
Dec 3, 2008 at 8:33pm

“It’s grim up north”, wasn’t that the wisdom that we received from The Justified Ancients of Mu Mu? ;)

And grim they are – because I don’t have Jitter!

Back to the drawing board, I guess.

#146381
Dec 3, 2008 at 9:05pm

Quote: oivindi wrote on Wed, 03 December 2008 12:09
—————————————————-
> The title says it all: What is the easiest/fastest way to fill matrixctrl with random values (0s and 1s)?
>
> I have come so far as to guess that “decide” can be used in some way or another, but would I have to make a list?
>
>
—————————————————-

Not in front of Max right now, so bear with me, but this should be pretty easy.

You’ll need two [uzi] objects. One for the number of columns, and one for the number of rows. Say your maxtrix is 4×8 then you’ll want an [uzi 4] and an [uzi 8]. The right outlet of those will dump out the numbers 0-3 and 0-7. Each time a number comes out of the first uzi, put it into the right inlet of a pack and bang the second uzi. The second uzi will go into the left inlet of pack.

This should output lists “0 0″, “0 1″, “0 2″, … “3 7″
Those are your matrix coordinates.

Then you just need to pick a random 0 or 1 for each coordinate (try [random]) and append it to the coordinate list and send it to matrixctrl.

#146382
Dec 3, 2008 at 9:38pm

Here is the method Adam described:

lh

– Pasted Max Patch, click to expand. –
#146383
Dec 3, 2008 at 10:15pm

I like doing stuff like this with Jitter, because it’s easily scalable.

Andrew B.

– Pasted Max Patch, click to expand. –
#146384
Dec 4, 2008 at 5:51am

Aye, I was figuring this out as well, to fill the [matrixctrl] with random values. For my FM Sequencer, which i happily ended up figuring out after 2 days of messing around.

After a few days of banging my head against the wall, messing with Max, did actually use the Jitter method instead, mainly because it was less cumbersome and i had paid for Jitter but have not used it to a great extent yet. So now have put my money to use :)

The other non-Jitter methods are more than fine, but if you do have Jitter, use the Jitter method that Andrew has pointed out. It is less space used and much easier…

#146385
Dec 4, 2008 at 5:59am

the one thing i am now figuring out now, is how to randomize a [function] ?

If any of you know, let me know please

Cheers…

#146386
Dec 4, 2008 at 6:26am

Quote: Lewis G. Edwards wrote on Wed, 03 December 2008 21:59
—————————————————-
> the one thing i am now figuring out now, is how to randomize a [function] ?
>
> If any of you know, let me know please
>
—————————————————-

Here’s an adaptation of the uzi approach. You may want to hardcode a start/end point, and maybe enforce a minimum number of points by running the first [random] through a [+].

– Pasted Max Patch, click to expand. –
#146387
Dec 4, 2008 at 6:40am

Nice Adam, Cheers very much…

#146388
Dec 4, 2008 at 6:44am

And here’s the Jitter version. Learned something new today thanks to this thread :)

– Pasted Max Patch, click to expand. –
#146389
Dec 4, 2008 at 7:39am

Well, Adam, you didn’t learn as much as me. :)

Thanks for all the great suggestions!

#146390
Dec 4, 2008 at 8:07am

#146391
Dec 4, 2008 at 8:56am

Great stuff, Chris – thanks!

I was about to post a follow-up concerning density, but your solution took care of that.

#146392
Dec 4, 2008 at 7:13pm

Quote: andrewb@cycling74.com wrote on Wed, 03 December 2008 23:15
—————————————————-
> I like doing stuff like this with Jitter, because it’s easily scalable.
—————————————————-

Nice example.

It may be worth noting that in generating a random 2d matrix with a linear congruence RNG (and jit.noise is, I think linear congruence, is it not?) there is an issue in that you will get more continuous lines (diagonals, horizontals, verticals) than a “true” random process ought to produce. This probably won’t be measurable in a 4×8 matrix, but since you mentioned scalability, at anything over say 100×100 the perfectionist might want to look at another noise source.

#146393
Mar 24, 2010 at 8:11pm

hi all,

i’m using the above method to generate a single 1 per column for a sequencer i’m building (i’ve set one non zero cell per column). could some one tell me why more often than not the following patcher seems to place all the ones in the bottom half of the rows? shouldn’t it be completely random?

– Pasted Max Patch, click to expand. –
#146394
Mar 24, 2010 at 11:00pm

You go from top to down, and you have checked “one non-zero cell per column” in the inspector, each setting on a lower row will uncheck the above…

try this:

– Pasted Max Patch, click to expand. –
#146395
Mar 24, 2010 at 11:42pm

thanks for the reply! that’s much better.

I should have said that the external synth i’m going to be sequencing is monophonic. so if i trigger two notes at once, the second note won’t fire. you can see here that i can go forwards and backwards in my simple seq.

how can i bang the matrixctrl so that a 1 is put randomly in each column and only 1 in each column – so that it doesn’t trigger 2 notes at the same time?

sorry if i’m not explaining myself correctly. i’ve only been using max the last 3 weeks…:)

– Pasted Max Patch, click to expand. –
#146396
Mar 25, 2010 at 5:57am

You patch is doing that, or do you mean it should play each row exactly once? Then look into urn or zl scramble…

– Pasted Max Patch, click to expand. –
#146397
Mar 25, 2010 at 10:20am

cool. thanks a lot!

#146398

You must be logged in to reply to this topic.