Forums > MaxMSP

Averaging/smoothing a ctrl object output

March 28, 2014 | 12:07 pm

I have MIDI cc messages incoming from an analog light sensor ranging between the values of 0-127.  The problem is that the readings are extremely noisy.  For example, if the sensor is reading 60, it will be fluctuating between the late 50′s and mid 60′s value as the sample rate is quite high (~20hz).  I tried the smoother object but I couldn’t get it to work.  The light sensor is controlling a few mix sliders.  I just want them to be smooth and not twitch erratically like they are now.


March 28, 2014 | 12:34 pm

you tried the [slide] object? why didn’t it work? post patch?


March 28, 2014 | 12:50 pm

Sorry, its probably because I’m new to Max. Here is my code, its without the smoother object


March 29, 2014 | 10:06 am

While a rather jittery controller input won’t help and may indeed need smoothing as well – The issue is in turning the 127 steps of the slider into a smooth gain value for an audio signal – Something like line~ (added in first ‘channel’ of your patch) should help.

<code>

– Pasted Max Patch, click to expand. –

</code>


March 29, 2014 | 12:48 pm

Many thanks, although the sliders are twitching like mad, the audio is pretty smooth. No clicking, etc. Its good enough for demo purposes until I learn more about Max. Do I need to add the line object to the other channels? Is it possible you could tell me what the line object is doing? Also, what does the dollar sign mean?


March 29, 2014 | 1:22 pm

Here’s a thread from a couple years back that discusses various methods:

http://cycling74.com/forums/topic/smoothing-out-numbers/


March 29, 2014 | 2:46 pm

Thanks :-)

Emmanuel J’s solution seems to work best for me at the moment.


Viewing 7 posts - 1 through 7 (of 7 total)