De-Clicking Buffer?

Hello,

I am working on a sampler/oscillator. The oscillator has no problem with clicks. However my grainular sampler and normal sampler have on note clicks while the envelope is releasing.

I currently have a smoother and a trigger to blend on notes when the envelope changes values dramatically.

Is it possible to make a small buffer that analyzes for clicks? I imagine some sort of minimum allowance for variations, but that ends up creating a low pass filter.

If anyone has a solution for re-triggering samples smoothly that would be awesome.

Thanks!