Need Help with Filter Envelopes

I would like the synth to stay on the server so I can re-trigger it. Whenever the filter envelope is over, I can’t get the filter envelope to re-trigger, even with a ‘gate’ argument. It stays at the lowest value, where the end of the envelope is set to when it’s over. How can I re-trigger the filter envelope, along with the signal? I’d appreciate any help

(\filterenvelope2, {
arg t_trig, t_trig2;
var env, sig1, sig2, mainsig, filter;

env =[0, 1, 0.75, 0.75, 0], [0.01, 0.2, 0.1, 3.0]), t_trig);

sig1 =*1.0052121400414757, 1.0);

sig2 =*0.9948148855014218, 1.0);

mainsig = sig1 + sig2;

filter =,[5000, 100], [0.5]), t_trig2));, env*filter.dup);

~filterenvelope2 =\filterenvelope2, [\t_trig, 0, \t_trig2, 0]).register;

~filterenvelope2.set(\t_trig, 1);
~filterenvelope2.set(\t_trig2, 1);

1 Like

Hi, this is (in my experience) a very common misunderstanding with envs. Your filter env:
Env([5000, 100], [0.5])
has an initial value of 5000 and one segment at 100. When you retrigger it, it never goes back to the initial value, but only to its first segment.
An Env’s initial value is never repeated.
That’s why 5000 is skipped when you re-trigger the env.

Quick fix: add a segment
Env([5000, 5000, 100], [0, 0.5])
This will make the envelope go to 5000 “instantly” when retriggered (and then it will take the usual 0.5s to get to 100).

Another thing worth remembering with envs: apart from the first value, which is just the initial values, all other “points” are segments. And the meaning of a segment is: go to a value (from wherever the env is at that moment) in an amount of time. They don’t mean “go from there to here”, but just “come here”

Hope it helps!

Thank you, that worked!

That’s really interesting, if I’m understanding correctly, I wasn’t aware that envs look at segments, I thought it was each individual value.

It’s not clear to me exactly what you’re trying to do here, but for my approach to a similar issue see: How to get constant slope instead of constant time envelope re-attacks?