Object that sends Bag when Numbers not Changing
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.
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.
: )
[delay] can act as a retriggerable one-shot:
Thank both of you!
Chris's answer is so easy and yet so effective.
Think I thought too much and overlocked the simplest solution.
Chris do you have an idea how I could get an additional bang in a simple way when the numbers start to change again?
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.
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.
`
Yeah, I forgot a [t b] before the delay. Andrew's solution fixed that.