Object that sends Bag when Numbers not Changing

Sym's icon

Hey, I'm looking for an object that can analyse a number object and send out a zero or one when the object has not changed for a specified amount of time.

I've already build it my own with the == object but it seems like it's to cpu heavy.

goingdeaf's icon

If working with timing limits, you could use the [if] object combined with the some sort of object which can deal with timing such as [counter].

Like this:

Imagine you want a 1 message when the [number] object has been inactive for more than ten seconds and a 0 message otherwise:

[if $i1 > 10 then 1 else 0]

Regarding the timing, you could use counter to count from 0 upwards. You could use the [metro] object to bang into the [counter] and cause it to increase.

Connect the outlet of the counter to the inlet of the [if] object and connect the outlet of the [if] object to a [toggle].

You may also need to reset the counter upon each 1 message, but this depends on your overall aim.

: )

Chris Muir's icon
Max Patch
Copy patch and select New From Clipboard in Max.

[delay] can act as a retriggerable one-shot:

Sym's icon

Thank both of you!

Chris's answer is so easy and yet so effective.
Think I thought too much and overlocked the simplest solution.

Sym's icon

Chris do you have an idea how I could get an additional bang in a simple way when the numbers start to change again?

Sym's icon

solved it. Just connected the change object to a toggle and made the bang send a message 0 to the toggle, Now it activates and deactivates itself with the numbermovement.

Andrew Pask's icon
Max Patch
Copy patch and select New From Clipboard in Max.
Peter Ostry's icon

Everybody knows that Chris is a genious and this idea was another small gem :-)

There may be one modification necessary though: Since the incoming data sets the delay time, the response time is varying. If you don't want that, just take a short delay but feed it with a constant value.

The patch below compares the two methods.
Try with negative values.

Max Patch
Copy patch and select New From Clipboard in Max.

`

Chris Muir's icon

Yeah, I forgot a [t b] before the delay. Andrew's solution fixed that.