## Acknowledging a sudden increase

Jun 21, 2013 at 9:24am

# Acknowledging a sudden increase

Hi

This is a difficult to explain but basically I have a numerical output which is always changing. However, I dont want to acknowledge the small changes in numbers, but only when the numbers increase quickly and a large increase of numbers.

If anyone has any ideas if this is possible, id appreciate the time,

J

#253595
Jun 21, 2013 at 9:36am

it really depends on if we are talking about consecutive numbers, about a certain time period, or about a tendency, the latter which would require that the user may (and have to) set the time and difference values arbitrarily.

for consecutive numbers, something like [if abs(\$f1-\$f2)>=50 then 1 else 0], where \$f2 is the last value, will be all you need.

if time is involved, [timer], and probably [accum] and [mean] should be created in your patch now as a precaution. ;)

-110

#253598
Jun 21, 2013 at 1:31pm

I don’t really know which of those options my situation fits into sorry.

If this helps, the numbers are the y corridents produced by blob tracking. So as you can imagine the numbers are constantly changing…

However, what I want to do is create a way of making the patch understand when those numbers rise or fall is over a particular range at a particular speed

I can’t quite get my head round that at the minute. Does it need to be something like, if a change over e.g 10 happens within 50ms then bang? does that make sense?

#253647
Jun 21, 2013 at 4:17pm

“Does it need to be something like, if a change over e.g 10 happens within 50ms then bang? does that make sense?”

yes, of course. just calculate a “velocity” value from these time and difference values, then work on that.

#253672
Jun 22, 2013 at 4:41am

Hi
here’s a Max solution (as opposed to a Maths solution); using [trigger], [pipe] and [-] to give you velocity. You will need to tweak a few parameters, as Roman states, to get the desired result.

<code>

– Pasted Max Patch, click to expand. –

</code>

There is a related thread here:

http://cycling74.com/forums/topic/simple-problem-detect-peaks-troughs-in-sine-wave-in-max-not-msp/

Brendan

#253722
Jun 22, 2013 at 5:01am

Wow, that is brilliant. Needs a bit of tweaking to fit my patch but that is spot on. Thanks

J

#253723
Jun 22, 2013 at 5:17am

:)
this forum is brilliant

#253725

You must be logged in to reply to this topic.