A while ago, I wrote a library of useful functions. One of them is an lfo function, and another is an envelope function. Both can be used with effects.
There’s lots of other cool stuff in there too. Check it out.
lfo and env are the most immediately useful to you. There should be example code in the docs on github.
Have fun!
I have an update to this library coming soon. I’m busy moving and retiring, but once I have some time I should get the new version out. Has tons of cool new features – playing multisamples with articulations, velocity and round robins; granular synth/effect; step effects a la Infiltrator; whistle and slidewhistle pseudo-synths; looping arpeggiator a la Harmony Bloom; and much more.
Looking forward to getting it out the door. It’s been in testing and debugging for a while, but I’ve been busy with other things.