env. following & inverted env. following (and suchlike)

kp*'s icon

So I am working with an envelope follower that i hacked up that works pretty well for ordinary amplitude following, which is great for dynamic processes, such as your classic auto wah, or wacky dynamic panning etc.

What I really want to accomplish is a kind of inverted envelope following. As I play more (and louder) it ducks and gets out of my way. Then when I pipe down, after a certain threshold is passed (and some time, I don't want it to honk the spilt second i fade out, infact, I'd like to be able to control that some)..

So I know that i can tweak the follower, and smooth it in various ways and I can prolly just use good old [!-~ 1.0] ---> [snapshot~ ] to get the inverse, but it just strikes me that what you would want in an env follower might be a tad different than what you would want in an inverted follower, depending on how you want to apply it musically (of course a plain old inverted follower works for much the same thing as a regular one does, in fact my old BOSS stomp box has a switch that inverts the env filter).

So imagine that I have some generative doodad that swoops around *but* I also have an open mic or a guitar and I want the generative biz to peter out or go to the background when when I start playing. Then I would like it to slowly fade back in after I have been below a certain threshold a certain amount of time.

What I have mostly works (the amp following engine) but it is just honking out a sine tone for now.

I'll post my code in case any one has any improvements or suggestion (or code) to add that might show me some further strategies.

It is amazing how well average~ into bitsafe~ and clip~ work. rms is great but even absolute works well for env. following.

Sorry if this is unclear. Thought that I would throw this out there on the off chance anyone finds this interesting or can suggest anything. I am playing a lot with controllers and such, but the idea of sitting with my instrument in my hand and not having to leave my instrument or touch the computer to switch is really appealing to me as a busy human improvisor it I have very little extra "bandwidth" while playing (i envy trumpeters who have a whole free arm!).

cheers,

kp

kp*'s icon
Max Patch
Copy patch and select New From Clipboard in Max.
kp*'s icon
Max Patch
Copy patch and select New From Clipboard in Max.

Slide is great for smoothing. Excellent for stuff like this and for smoothing sensor data.

I'll have to scratch my head over the phasor/cycle cosine idea. I don't quite grok that. But i'll give it the ol' college try. Thanks. Thanks for the patchette. Very elegant and short winded. I got carried away and made a big junkyard thinking out loud in my patcher.