Forums > MaxMSP

Filtering backwards and triple lacing lists

November 6, 2008 | 8:38 pm

First post ever… nice to be here… here we go:

I would like to do two things with any list, of any length:

1) Remove any quantity of "32"s (for this project, ascii blank spaces) from the end of a list, however many there are, but not any "32"s inside of the list. Example:

240 32 66 88 44 32 32 55 96 32 32 32 32
would become
240 32 66 88 44 32 32 55 96

2) Lace three lists together. Example:

240 32 66 45
22 36 89 88
26 33 78 91
would become
240 22 26 32 36 33 66 89 78 45 88 91

Working with ints in this project, but lists of any kind of symbol, int or float would be nice to know how to triple lace.

Being a noob, I’v tried to go through the zl objects, but haven’t really came up with a solution.

Any ideas?


November 7, 2008 | 12:30 am

Here’s an easy way to combine three lists. Just use two [zl join] objects that are cascaded into each other. The gate object in this patch just cycles the messages around so that everytime 3 lists are entered, they get output joined together.

– Pasted Max Patch, click to expand. –

November 7, 2008 | 12:36 am

This works too, and is a little more efficient. The sum of the lengths of all three lists is limited to 512 elements in this case.

– Pasted Max Patch, click to expand. –

November 7, 2008 | 12:46 am

For removing the last 32′s off your lists, I probably would have made this in a js object by default, but it turns out it’s not that hard to do with max objects, using recursion. If you can’t figure out how this one works, enable debugging and step through it message by message.

– Pasted Max Patch, click to expand. –

November 7, 2008 | 12:50 am

This should solve your other problem.

lh

– Pasted Max Patch, click to expand. –

November 7, 2008 | 1:00 am

To interleave more than two lists, use Peter Elsea’s L-objects, specifically Lmerge. Your other problem would probably be more easily addressed if you convert the numbers to ascii text and modify with sprintf, or some other text-parsing object(s).
T


November 7, 2008 | 12:07 pm

Thanks for the help!

Swieser1 and thereishopeforus, both your solutions to backwards filtering are spot on. Deferlow seems handy for recursion and a lot of other things, didn’t know about that object.

Terry, I’ve checked out Lmerge and it fits the bill, however, I would prefer to use standard objects to make my triple interleave. I want my solution to be as portable as possile. It becomes more acute as Peter Elsea says in the documentation that the alias Lmerge3, which I need to use for my interleaving, is probably on its way out.

Sweiser1, I appreciate your work on triple lacing/interleaving, but it is not quite what I was looking for. Your solution joins the full lists after one another. What I would like is to make a list with element 1 of the first list, followed by element 1 of the second list, followed by element 1 of the third list, followed by element 2 of the first list, followed by element 2 of the second list, followed by element 2 of the third list, etc.

Same function as "zl lace", but with three lists.


November 7, 2008 | 1:32 pm

Ok, I made a simple patch interweaving three lists. Obviously inspired by the previous answers in the post, I might be using "deferlow" a bit abusively. It seems a litle beyond control having several instances of "deferlow", not really sure how it would work in a big patch with lots of crap going on simultaneously.

Anyway, suggestions for improvements are welcome.

– Pasted Max Patch, click to expand. –

November 7, 2008 | 2:07 pm

On 7 nov. 08, at 14:32, abcdaniel wrote:

> Ok, I made a simple patch interweaving three lists. Obviously
> inspired by the previous answers in the post, I might be using
> "deferlow" a bit abusively. It seems a litle beyond control having
> several instances of "deferlow", not really sure how it would work
> in a big patch with lots of crap going on simultaneously.

abusively is the term ;-) You might want to have a look to trigger to
defines the order of the operations. BTW, if you want to interleave
more than 2 lists, you can use [mxj list.Multiplex 3].

Best,
ej


November 7, 2008 | 5:15 pm

In defense of lmerge, the lmerge3 thing might be on its way out, but its been replaced by an argument/message lmerge. If you check out the ‘new way’ subpatch in the lmerge help file it will explain.

Also, lmerge has the ‘useall’ message which I’ve found very helpful as it avoids the list-truncation behavior of [zl lace]

– Pasted Max Patch, click to expand. –

November 15, 2008 | 1:14 am

I knew there was a way to do remove the repeated end values using regular expressions but it took me a while to figure out (regexes give me headaches!) This should do what you want in one object and you can change the value to filter from 32 to anything you want.

lh

– Pasted Max Patch, click to expand. –

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