Basic envelope follower in gen~?

Hello!
The title says it all. I think i am quite capable of getting a lowpass filter to work, which would get me some kind of envelope follower right? But i plan to create a compressor in gen~, the only tricky part being to have separate controls for attack/Release. I think i might even have some ideas, but they seem a bit workaround-ish, so, some basic conceptual thoughts would be really helpful.
Any ideas?
Thanks for your Time!

I like to do some combination of short-term averaging followed by the slide~ algorithm (aka RC envelope). Slide~ just uses different coefficients depending on whether the input is greater than or less than the previous input.

You will also have to delay your input since this will introduce some latency. You could also experiment with doing all of this in the decibel domain, which would probably be helpful for a compressor.