zl.group question.

pW4lnuts's icon

Hi!
Im thinking theres a really simple fix for this, but Im new to the zl.objects, so just looking for some advise.

Im looking for a way to break up the output from a zl.group object. In my patch ive got an input with 64 digits, Im wanting to separate this into 8 separate lists of 8 digits, this is what I get when I print the output to the max console, but when the output from the zl.group goes to a message box I just get the 8th list .

How can I get zl.group to output the separate lists outside of the max console? Hope that makes sense!
Thanks!

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

Max Gardener's icon

It doesn't entirely make sense to me, but I'll try. If you mean that you want to break up the jit.spill object's output into 8 separate lists, this is certainly one way to do it. As to doing it "outside of the Max console," I'm a little confused - the print object is what's sending the results of unpacking the big list to the console, so just put something else in place of the print object (say, a zl reg object or a message box, or just send the lists of 8 things to whatever it is you're patching that works with lists of 8 things). Is that what you're asking?

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

tyler mazaika's icon

You only see the 8th list of numbers in the message box is because each time a message goes to its right inlet it overwrites the content of the message, and that happens extremely fast (~instantaneously). So the message box does get all the lists from the zl.group object sent to it, but it only displays whichever list of numbers came last.

Are you trying to display all 64 numbers at once within your patch?

Peter Ostry's icon

Distributing 64 digits to 8 message boxes?
See two methods in the patch below.

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

pW4lnuts's icon

Thanks Max!

Sorry I think I confused things by mentioning the max console, I only bring it up because once the lists are printed to the console it appears the way I had in mind, where as when the output of the zl.group is sent to a message box I only see the last list.

Thanks Tyler, I did think that was what was happening, just couldnt think how to unpack the 8 lists. The zl.slice has worked a treat though.

Thanks friends.

pW4lnuts's icon

Thanks Peter.

Thats the ticket, thank you so much.

Jean-Francois Charles's icon

Since your original question started in jitter world, you could also do the slicing and routing in jitter world, depending what you do with the data later...

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

mizu's icon

funny, and a way with spray in list mode

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

bzzz

Marc Assenmacher's icon

Reviving this thread with another zl.group question.

zl.group n seem to split a message in n parts and send them out as separate messages.

How do I recombine these messages back to one large message?

I think it should be very simple, but I can't find the solution here.

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

Sébastien Gay's icon

zl.group m, m being the initial list's size ?

Marc Assenmacher's icon

Oh my.... thanks a lot for this! I never thought of that.

Roman Thilenius's icon

group n will only output the first subset. to iterate the whole list, user iter n.

Sébastien Gay's icon

When investigating Marc's idea, I was myself a bit surprised to see that zl.group and zl.iter give similar results :

Not in all cases ? I don't know.

TFL's icon

I think the basic idea behind [zl.group N] is to work with lists smaller than N (to group them as lists of size N), while [zl.iter M] is to iterate through lists bigger than M (to successively slice them in smaller lists of M items). But they've been programmed in a way that make them accept lists bigger than N for group and smaller than M for iter, for convenience I guess?

They work the same, but give different results when both working with lists smaller than their argument:

Roman Thilenius's icon

group´s main feature is to collect successive messages until N is reached, so it is basically the opposite of iter.
it can accept lists in addition, and then it iterates the list elements before (re)grouping them.

for the above use case group only works one time like iter, and only when the length of the input list can be divided by N without rest.


Sébastien Gay's icon

"only when the length of the input list can be divided by N without rest."

yes of course ... and [zl.iter 2]'s last output's length is 1 and not 2 in your example.

Still, [zl.group n] seems to start with a [zl.iter n]-like step before further processing its input.

Of course, depending on your context it can be useful or not. Another good tip to know, anyway !