Make a bang if 0 appears for 1-2 seconds.
Hey there,
I'm working on a color tracking patch and ran into a rather basic problem.
I would like for my patch to produce a bang when it identifies an int 0 from both the X and Y axis.
The trick is I want this to happen only after one second of a constant 0 (from the X and Y).
the result would be that if I am tracking a color and it disappears from the screen for more than one second I would get a bang.
I'm thinking this should be done with some sort of delay but I couldn't figure it out yet so I thought I should ask the good people of this forum.
Cheers,
UV
there might be a simpler way-- but I dont think [pipe] works in this context, hence using [delay]
Here's a slightly different approach.
Just because I don't like the [if] object, a slight modification to bkshepard's patch ;)
Nice! Out of curiosity, is the [if] object that much less efficient?
not a huge difference, but on my machine when I benchmark the two patches with 10000 iterations, yours clocks in between 8.7-9.2 ms, whereas the other does between 7.2 and 7.5
your not gonna feel a difference between the two unless you are really , really starved for CPU cycles - or have 10000 of them running at the same time ;) -, but I was taught that the [if] statement is incredibly slow, so I avoid it when possible.
I will use it for instantiation (a one shot deal), but rarely in the inner workings of a patch.
Thanks for the explanation. I, too, had always heard that it was better to avoid the [if] object when possible, but hadn't ever noticed a problem. Probably because I usually only use one of them rather than 1000 ;-)
Guys thanks so much for the simple and elegant patches. This will serve my project very well. This is why I love this community.
I'll probably use the modified one without the [if].
Thanks a lot.
I have another burning question but I will post it later.
:)
hi !
just for reminding the "stop" message for delay :)
maybe make use of the skeptic object?