Forums > MaxMSP

Random lists with Zl Join

Jun 18 2013 | 11:23 am

Hi, i’m trying to create a list of random numbers with Zl Join.
Theorically i must create a list with the last generate number and the list himself, and after that i probably need a "zl rev" to have the correct order.

The only thing is that i’m not really praticed with Zl and the output of zl is nothing, anyone can post an example of that, thanks?

Jun 18 2013 | 11:34 am

Do you want something like this:

-- Pasted Max Patch, click to expand. --



Jun 18 2013 | 11:40 am

Nope, i don’t want to put an end to the list.
For example, i want to put a button before the random and every time i press it, another number join the list.

Also, i request the zl join because i want to learn better how it worked.

Jun 18 2013 | 12:05 pm

Aha! Like this, then:

-- Pasted Max Patch, click to expand. --


Jun 18 2013 | 12:13 pm

Theorically yes, it’s similar to mine but…
It don’t work.
The message still empty, no matter how much times i press the button.

I use Max 5, it could be a problem?

Jun 18 2013 | 12:14 pm

Ok, probably the 5 don’t understand the [zl.join] but with the space instead of the dot it work.
Thanks! :)

Jun 18 2013 | 1:47 pm

Zl join is fine for joining lists, but I prefer zl group (with no arguments!!!) for making arbitrary lists. It’s a lot simpler:

Send whatever numbers/symbols you want, then send a bang to output the list.

Just be sure to not specify a list size as an argument.

-- Pasted Max Patch, click to expand. --


Jun 18 2013 | 1:55 pm

Well, but with that isn’t also the list lenght at random every time i add a number?

The solution posted by Mzed is perfect for what i want.

Now, i’m continuing my work but i’ve got another number.

For example, you know the "Simon", right? (It’s good for my example)
Suppose that i want to send the number to the corresponding led, and after the program read all the list, i must insert by pressing buttons (take 4 as example, just like Simon) the corresponding sequence (and return wrong when i made an error).

What i must use? I’ve read that probably Zl Nth could be useful, but personally i’ve never use that.

Jun 18 2013 | 3:14 pm

slightly ot now since i don’t know that Simon, sorry.
@Peter : i think the default max length will always be 512 elements though. To overcome this you must write e.g. [zl 4096 group].

Also without zl you can do this :

-- Pasted Max Patch, click to expand. --


Jun 19 2013 | 3:10 am

There are a number of externals for randomizing lists(*). The original external doing this sort of thing, called [scramble], was written by James McCartney and hasn’t been supported for a long time. Litter Pro users will know lp.crabelms, and someone else has written a more recent list scrambler.

(*) As always, lists in Max must, technically, have an int or a float as the first item, otherwise you have a message followed by parameters and not a list. All of the list scramblers, however, conveniently treat messages as lists, just to make life easier.

Any object for randomizing (scrambling) lists will probably be the most straightforward way to get the results you want.

As for the [zl.join] syntax: introduced in Max 6. Previously there was one [zl] object, and one object only(*), for general-purpose list manipulation. You specified which type of manipulation with an argument ([zl join], [zl split], etc.). Since Max 6 there are lots of individual list-manipulation objects that, by a completely arbitrary convention adopted by Cycling ’74, all begin with "zl." — I’m guessing that the idea was to provide the convenience of automatic object name completion.

Inserting a parody of the Lord of the Rings poem ("…one ring to join them all, and in the darkness bind them…") is left as an exercise for the Reader so inclined.

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

Forums > MaxMSP