Looking for time-delayed ramping object
I'm working with my iPhone (specifically TouchOSC) to manipulate audio and MIDI through Max. I want to use one of the sliders in TouchOSC as pitch bend. I have everything working just fine as far as being able to bend the pitch using the slider, I'd just like to be able to treat it more like an actual physical pitch bend on a keyboard in that I want it to snap back (slowly) to 0 when I release it.
Basically I need an object that will only activate (send a value to TouchOSC) when I am no longer changing values. Something that I can just set to know to ramp back to a specific value if nothing has come in for X amount of milliseconds.
Does this make any sense?
I can put together a little example patch if needed.
Thanks so much.
Jon
maybe something like this??
two quick examples. the first one only ramps to the value if it isn't changed for 1000 msec. the second one will change the value back to a preset value if there is no incoming number for more than 100 msec.
hope this helps.
Thanks for the reply MIB. The example on the right is almost exactly what I need. The first time I tried it it worked perfectly but if I go to change the values a second time, it will snap back to 0 immediately instead of ramping over time. Also, it doesn't always pick up right away as I start changing the values after it has been set back to zero.
you are right I forgot to set the new value in the line object. i also added a stop message for the line object which will stop the ramp if a new value comes in.
here is the improved version:
Perfect! That's exactly what I need. Thank you so much!
Jon