Forums > MaxMSP

routing repeating values

Oct 08 2008 | 8:14 pm

Hi all, I was wondering if anyone could point me in the right direction here. Sorry if there is a simple solution i am overlooking but my brain is hurting right about now.

I am looking for an object or objects from which I can build an abstraction that will analyze an incoming stream of numbers and route any repeating numbers in that stream to a different location than the others.

If a 1 is followed by a 1 then both 1s go left, and then if three 2’s follow those 1s they also go left.
single digits go the opposite way.

Any help would be greatly appreciated. just point me in the right direction.


Oct 08 2008 | 8:19 pm

Oh yeah, It only needs to re route values that are the same one right after the other. If a 1 is followed by a zero and then a 1, it would not need to be re routed.


Oct 08 2008 | 8:27 pm

Well, as with most things in Max, there are many ways to accomplish this.

You’ll need to delay output by one number, so int, float or maybe bucket would work here.

Next you’ll need to compare the latest number to the previous number. sel or == would work here.

Finally, something like [gate 2] could steer the output to different places.


Oct 08 2008 | 8:53 pm

This abstraction will do what you want. It is a little bit more complicated than Chris tried to explain as you need to check the value before and after to see whether they are the same or different. However this does mean that the output is one step behind the input.


— Pasted Max Patch, click to expand. —
Oct 08 2008 | 9:52 pm

Thanks a lot for your help guys.

No problem about the I/O latency, because I’m just storing the data.

I’ve got another question, I’m assuming that the || symbol in the if statement is C language syntax. What exactly does it mean?

Thanks again!


Oct 08 2008 | 10:10 pm

It means "or", you can also use && which means "and" they’re useful for setting conditions in [if] statements.


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

Forums > MaxMSP