Filtering only big changes (Processing)

Quick_questions:

smoothed = ((weight * smoothed) + newSample) / (weight + 1);

I'm sure you get the idea.

actually I dont get the idea, could you elaborate?
[/quote]

The idea is that the input is a sequence of values which are varying slightly. The output is a value which represents the average of recent values so that it only changes relatively slowly. In the code I posted, smoothed is the output value and newSample is the new value. Weight determines how slowly the smoothed value changes. A weight of zero means the smoothed value is always equal to the newValue - no smoothing at all. Bigger numbers mean more smoothing - the smoothed value will change more slowly. If you don't get how it achieves this then make up a sequence of input numbers and run the calculation through in your head to see what it does.