Output the last value before the input changed more than a threshold.
The input signal.
Difference threshold.
Return the difference between current and the last changed:( d = { arg out=0, val=1; SinOsc.ar( abs(val - LastValue.kr(val)) * 400 + 200, 0, 0.2 ) }.play; ) d.set(\val, 3); d.set(\val, 2); d.set(\val, 0.2); d.set(\val, 1); d.set(\val, 2); d.free;