Forums > MaxMSP

Detecting a fast numerical increase or drop

August 7, 2013 | 9:50 am

I have incoming numbers of 0 – 127, how would I want to do something like this: if $i1 decreases by 30 in 10ms then bang.

I’m trying to create sword effects triggered by wiimote movements and I want the "clang" sample to be triggered if a sudden decrease in accelerometer data is detected.

Any ideas?

Thanks in advance, you guys have been great in the few days since I got my Max license. Hopefully I’ll have learnt enough to be able to help out others before too long.

August 7, 2013 | 10:42 am

Not to self promote, but I’ve made a video tutorial on doing basically exactly what you’re describing. You can cheggiddout here:

That being said, if you’re looking for something you can copy-paste, something like this might get you started:


– Pasted Max Patch, click to expand. –


August 7, 2013 | 10:49 am

One way to detect a large drop between successive input values. Edit: posted this before seeing Sam’s response. Different approach to timing but otherwise similar…


– Pasted Max Patch, click to expand. –


August 7, 2013 | 1:37 pm

Thanks both.

Sam – is there any reason why the patch you describe in your video wouldn’t work using the ctlin object rather than udp?

This is what I have at the moment and it doesn’t seem to be working. The number object displays incoming MIDI numbers so osculator is working fine.

Edit: I’ve decided to just go with the UDP method as it seems to be working well. I am curious as to why my patch wasn’t working though…

– Pasted Max Patch, click to expand. –
Viewing 4 posts - 1 through 4 (of 4 total)