Filtering only big changes (Processing)

How about : take the current running total, multiply by seven eighths and add one eighth of the most recent sample?
(Substitute any unity sum fraction and timescale you wish)