freq = 0.5; decay = 1; val = value n = 0; if (numKeys > 0){ n = nearestKey(time).index; if (key(n).time > time) n--; } if (n > 1){ w = freq*Math.PI*2; for (i = 2; i <= n; i++){ t = time - key(i).time; if (t > 10/decay) continue; amp = velocityAtTime(key(i).time - .001); val += amp*(Math.sin(t*w)/Math.exp(decay*t)/w); } } val