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.
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.
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.
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.
----------begin_max5_patcher---------- 449.3ocwU9sSCBCEF+Z3onoYWhKskw1zjcgOGlECCJtpP6xnDmts2cosfCUl zoD1MszCky466G8O6ccfqD6n4PvcfG.NN6ccbzgTAbpF6.yB2EkFlqmFTTHS oRnm4UaBkQqY7mdbKMRZRCdZvXjG.GbqpiDT2BVV8MrXShV87MSP0IhWjw3k IVWD7oflxoihphFIxxnbc0fPUnittpFu9xAAys1.9yuBFPWm55Zxu7sMTi3g vO04YsV.wBmMsUmgZ0Y3dxYb5qk0ttvR5NSpXIfQI3EKFkPNbnrQ8jOPtlxK iS.zzbJnTMD0n5ONkwoQhBiXHmEVdVALLw2zMU04OoAxRDbYN6ccBwJt9CRR HsRR+FIfGloS.79srvTXqLlze7TBR.ImcATRpHTp.i4gtoyL8FkYjwAkKmPW Fav+59mq.aVUD8BUBHv+7RFr1p.LBWgEzkiETuiEc006J91w8ZGnh+UVkKJ1 FU645eUfSlHllKY7PISvaNIxWlzZVbLk27biLV7FAiKqDAXYq+4rVSpxg6PS pKYFZM0EmT2aLjZBYAmzBmLrZxp0S3gSSXa3zvtdRcQb2bB+OzT4fite.zoB HM. -----------end_max5_patcher-----------
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?
It means "or", you can also use && which means "and" they’re useful for setting conditions in [if] statements.
Forums > MaxMSP