Forums > MaxMSP

### opposite of change?

Oct 23 2013 | 9:23 am

hey,

i only want to keep the repetitions in a stream of numbers,

so if its like 46 42 36 36 36 36 42 i want to "isolate" 36 36 36 36

thanks!

Oct 23 2013 | 9:29 am

Something like this?

```<code>
-- Pasted Max  Patch, click to expand. --

</code>
```
Oct 23 2013 | 9:42 am

This works, but you may add a copy of the repeated number to the output, because i misses the first one before it gets that it’s repeating.

```<code>
-- Pasted Max  Patch, click to expand. --

</code>
```
Oct 23 2013 | 9:44 am

Do you need all four 36s in the above example? If so, here’s a slightly different take which compares it against two neighbors. (I’ve included Mike S’s for comparison)

```<code>
-- Pasted Max  Patch, click to expand. --

</code>
```
Oct 23 2013 | 9:50 am

:-)

Oct 23 2013 | 10:11 am

pretty hard to compare a number to the next number in a stream ^^

Oct 23 2013 | 11:00 am

Yeah, there’s a latency of one value, but you also correctly identify all values in the long run. Can’t have it both ways…

Oct 24 2013 | 9:52 pm

With a simple modification to output the initial integer, Mike S.’s approach is almost twice as fast as the others..

— Pasted Max Patch, click to expand. —
Oct 25 2013 | 6:34 am

thanks all!

(still have not looked at the patches though…as im trying to solve it in an easy way.:)

Oct 25 2013 | 6:48 am

I stand corrected. Nice solution, Metamax.

@FlowDesigner Here’s an encapsulated, drop-in ready version of Solution A (Mike S./Metamax).

```<code>
-- Pasted Max  Patch, click to expand. --

</code>
```
Oct 25 2013 | 4:59 pm

yet another solution. Maybe not the most efficient, but with fewer objects:

```<code>
-- Pasted Max  Patch, click to expand. --

</code>
```
Viewing 11 posts - 1 through 11 (of 11 total)

Forums > MaxMSP