Envelope follower mapped to parameter to toggle it max/min with each hit

totenmusik's icon

Hi! This seems like it should be simple, and I have tried to figure it out myself, but . . .

I have audio going into an envelope follower, and have used the map function to control a parameter. The audio source is basically percussive with space in between hits. Of course the parameter follows the rise and fall of the envelope from the follower (and I see how to invert its response), but I don't want that. I want the signal to the envelope follower to cause the parameter to go to the maximum output value on the first hit, and then send the minimum value on the second hit, and then continue to do this with each subsequent hit. Basically creating a toggle that alternates between max and min with each successive trigger from the envelope. The target parameter is not a switch or an on/off. And anyways, when mapped to a switch, the switch is on for any value above zero and then off for zero. So even if I was targeting a switch, I would want the switch to STAY on until the next pulse from the env follower, THEN turn off (and continue to toggle with each subsequent hit.) It is amazingly hard to google a solution because every result assumes that I'm trying to go with the default behavior, or NOT toggle, or whatever.

I have Live 11 full suite, so I have access to M4L, I just can't figure out how to accomplish this with M4L (or otherwise.) Hoping someone who understands my goal can suggest a solution, or point me to something that already does this that I have missed.

Thanks!

Totenmusik

Roman Thilenius's icon

the easy way is to use the toggle GUI object. the better way will be based on either [cycle] or [counter].

double_UG's icon

something like this? I´ts not really tested.

Note On to Maco 01.amxd
application/octet-stream 212.59 KB

totenmusik's icon

I should probably add that I haven't actually created a M4L patch yet, so I probably need to learn more about how it receives input from the track or from other devices in the chain. I've done some work with Max outside of Live though. So, DOUBLE_UG, this is very cool that you posted this, but I don't know how to map it to a control in another device, say "wet/dry" mix, or "reverb decay." Is that built into this patch or something I need to add?

totenmusik's icon

Roman Thilenius - these are great suggestions. Now I need to figure out how incoming audio would trigger the input to the [cycle] object, and then how to map the resulting output to control a parameter like "wet/dry" mix, or "reverb decay." If you don't have the inclination to go into detail about stuff that is probably pretty basic, would you be able to point me to a good tutorial? Thanks!

Roman Thilenius's icon

to be honest one would probably build this kind of thing using audio signals only.

but because it is an important lesson how to connect audio to bangs and back, you should continue what you planned - and post your patch when you get stuck with one of the parts needed.

double_UG's icon

@ totenmusik, put the device in a rack, press "OFF/ON" toggle above the "1 Macro" Slider, then the device controls the macro of the rack

totenmusik's icon

Yes! DOUBLE_UG, that did the trick and is doing what I sought for the experiment I'm working on. There's only one modification I would make (if I knew how): Allow the input signal to come diractly from an audio track as well as from a MIDI track.

Either way, THANKS!