Forums > MaxMSP

Object to delace lists with patterns different from odd/even ?

March 17, 2010 | 8:12 pm

Hello,

I want to delace some lists, however I don’t want to do it the same way as zl delace.

Example :

With an input list like this one : 1 2 3 4 5 6 7 8 9, I would like to get 1 4 7 on one side and 2 3 5 6 8 9 on the other side.

Of course I could try a combination of counter, zl nth, pack etc but anything simpler would be welcome!

Any idea, Max gurus ?

Thanxinadvance.


March 17, 2010 | 9:39 pm

I would use listfunnel.

– Pasted Max Patch, click to expand. –

March 17, 2010 | 9:42 pm

btw, this is typical case where textual language might make things easier. Something like that should work in js (forum coding)


outlets = 2;

function list()
{
var a = new Array();
var b = new Array();

for (var i = 0; i < arguments.length; i++) {
if ((i % 3) == 0)
a[a.length] = arguments[i];
else
b[b.length] = arguments[i];
}

if (b.length)
outlet(1, b);
if (a.length)
outlet(0, a);
}


March 17, 2010 | 9:53 pm

Thanks, Emmanuel.

No magical plain-vanilla Max object to achieve this?


March 17, 2010 | 9:58 pm

how about [zl iter] –> [zl slice]? tell zl iter the chunk size (like 3), then slice off the first element of each group, the others go out the right outlet.

Or maybe you could generate a list of which elements you want, exactly, and send it to [zl nth]. But that’s probably the same as filtering out from the other side.


March 18, 2010 | 8:16 am

Thanks James but I meant *one* plain-vanilla object, you know that kind of magical object you have never used and have suddently discovered and you wonder how you could have done without until now…



Ch
March 18, 2010 | 8:33 am

You can use [zl list.Demultiplex 3] as well

Ch


March 18, 2010 | 9:36 am

You meant "mxj list.Demultiplex 3" I suppose. Thanks, I didn’t know this one.


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