routing repeating values

Oct 8, 2008 at 8:14pm

routing repeating values

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.

Thanks

#40231
Oct 8, 2008 at 8:19pm

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.

WPPK

#142192
Oct 8, 2008 at 8:27pm

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.

-C

#142193
Oct 8, 2008 at 8:53pm

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.

lh

– Pasted Max Patch, click to expand. –

#142194
Oct 8, 2008 at 9:52pm

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!

~WPPK

#142195
Oct 8, 2008 at 10:10pm

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

lh

#142196

You must be logged in to reply to this topic.