I am going to kick myself, but...

hankwitecki's icon

What objects should I use to monitor/observe/process an int so that if the number increases it will output a 1 and if the number decreases it will output a -1?

Maybe it's too many hours on this project, but I cant seem to get this...

Thanks in advance for any help,

-Hank Witecki

bennyfromtheblock's icon

Try this mate,

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

I'm sure there must be a more elegant way of doing this but it's a start

Benny

johannes's icon

hello henk,

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

here is my ftm solution … you will need to download ircam´s ftm lib,
other wise the patch will not work.

you can download ftm here:
http://ftm.ircam.fr/index.php/Main_Page

greetings,
johannes

yair reshef's icon

i used f0.inc_dec_split - detect direction of incoming values and split to different outlets
http://www.fredrikolofsson.com/pages/code-max.html

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

From the change help file:

yair reshef's icon
Max Patch
Copy patch and select New From Clipboard in Max.
bennyfromtheblock's icon

Chris's way is far better than mine I'd say. The first thing I looked at was in fact the change object but I completely missed the bit at the bottom of the helpfile.... hidden in plain sight! Ha

hankwitecki's icon

Thank you all so much,

It makes an artist so happy to come home at the end of a long day to see a brilliant community of helpful people with so many unique solutions to a problem.

I ended up using Benny's example, as it was the most precise, but you all have provided great examples, and at the risk of repeating myself I just cant thank you enough!

-Hank

Roman Thilenius's icon

if $i1 > $i2 then 1 else -1

with the input fed into both inlets of if.

woyteg's icon

nice one roman

hankwitecki's icon

if $i1 > $i2 then 1 else -1

the two numbers are always going to be the same... that wouldnt output anything... you could do a zl.queue or something to store the previous number and then compare them in the if... but this works PERFECTLY vvvvv

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

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

This patch collects and measures the timing of the 100% Max distributions mentioned so far.

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

yes, the if thing would then look like that.

johannes's icon

nice comparison, chris.

yair reshef's icon
Max Patch
Copy patch and select New From Clipboard in Max.

:) mine's smaller

yair reshef's icon

"on a serious note"
dealing with repeating numbers

benny: will pass -1
change: will pass nothing (naturally)
yair: will pass 0
roman/johannas: pass -1
f0.inc_dec_split: pass 1

as always, removing updating screen elements shaves a few cycles.
thanks chris for the benchmark patch