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){ amp = velocityAtTime(key(n).time - .001); w = freq*Math.PI*2; for (i = 2; i <= n; i++){ t = Math.min(time - key(i).time,10/decay); amp = velocityAtTime(key(i).time - .001); val += amp*(Math.sin(t*w)/Math.exp(decay*t)/w); } } val