I have 30 frames to work with.
I need an output value between 0.0f and 4.0f to apply a "shake" to an object within that 30 frames.
I want the shake to ease in and ease out.
Sounds like a case for the classic cubic S-curve, which takes an input from 0 to 1 and outputs a value from 0 to 1 that is horizontal at both 0 and 1:
s(x) = 3*x\\^2 - 2*x\\^3 (note, a\\^b means a to the power of b)
so if your shake value eases in from 0 at frame 0 to max value at frame A, then stays at max until frame B, then and eases out from max value at frame B to 0 at frame 30:
if f \< A: return s(f/A)
if f > B: return 1.0 - s((f-B)/(30-B))
and multiply the output by 4.0 which is your desired max value. I love that little function. Other alternatives:
s(x) = sin(x*PI/2)\\^2 is slightly smoother
s(x) = x - sin(x*2*PI) / (2*PI) is noticeably smoother
Try them in for example http://rechneronline.de/function-graphs/ to see what they look like.
that represents the "amplitude" of the shake, and then somewhere else you generate some vibration using that amplitude (probably some kind of cos() like Omni suggests) with a frequency of your choosing.