I have a page describing a very simple, very low-CPU low-pass filter that is also able to be framerate-independent. I use it for smoothing out user input and also for graphing frame rates often.
http://phrogz.net/js/framerate-independent-low-pass-filter.html
In short, in your update loop:
// If you have a fixed frame rate
smoothedValue += (newValue - smoothedValue) / smoothing
// If you have a varying frame rate
smoothedValue += timeSinceLastUpdate * (newValue - smoothedValue) / smoothing
A smoothing
value of 1
causes no smoothing to occur, while higher values increasingly smooth out the result.
The page has a couple of functions written in JavaScript, but the formula is language agnostic.