Hello all,
I'm pulling data from four ultrasonic sensors into PD. The sensors are managed by Arduino.
Everything is working so far, and I've made some midi controllers from the sensor data for use in ableton live.
Basically, Arduino is sending an array of sensor data to PD which is then parsed and split up into Midi CC sends. Arduino is already sending the range constrained within midi controller numbers 0-127.
I'd like to enhance the behavior a little. When someone walks into the sensor from the side, it jumps up suddenly to reflect what ever distance they are from the sensor, and when they leave the beam (out of the side of the beam), it drops back almost instantly to 0. THis is normal of course, but I'd like to accommodate for this in PD. I'd like to gradually ramp the midi controller up and down to eliminate these abrupt changes... it would be nice if the maxmum speed it could go from 0-127 was a second or so.
I'm really at a loss as to how to smooth something like this out, when it is always changing. Ramping up to 127, or down to 0 gradually would be relatively easy... but ramping up gradually to 50, then down to 30, then up to 127, or back down as people move in and out... that's beyond me. The number to which they should ramp will be dynamically changing, and it would likely change even before it reaches the last initial target. Basically in animation, this behavior would be called easing.
I may not be able to get this working, but right now I'm not even sure how to get started fiddling with something like this.
So, my question is, where should I look to get started? A low pass filter or some other type of envelope?
I've attached a stripped-down sketch that shows the main section, basically pretty simple... four sliders (just visual indicators in this case) and four midiCC sends.
Any tips to point me in the right direction would be much appreciated. Maybe this is too complicated?
Thanks!
http://www.pdpatchrepo.info/hurleur/programmController_v10.pd