Filtering live input triggers

I am having a problem figuring how to filter trigger events so that an envelope finishes before a new envelope can be triggered. The context is triggering a filter with a live guitar signal = touch wah. I can get the classic touch wah sound with the same behavior as a guitar pedal: a new envelope can be triggered before the current envelope has finished. Now I want to experiment with letting the envelope finish before allowing a new envelope to be triggered.

In other words, I want these two cases to produce the same result (the top one):

(
{
	var trigsig = Impulse.kr(4);
	var sig = Env([0, 1, 0], [0.1, 0.1], [4, -4]).kr(0, trigsig);
	sig
}.plot(1)
)

(
{
	var trigsig = Impulse.kr(8);
	var sig = Env([0, 1, 0], [0.1, 0.1], [4, -4]).kr(0, trigsig);
	sig
}.plot(1)
)

Any suggestions? I feel the answer must be very simple, I just can’t wrap my head around how to do it.

You can use Trig, which is a timed trigger, based on the length of the envelope:


(
{
	var trigsig = Impulse.kr(8);
	var envDuration = 0.2;
	var envTrig = Trig.kr(trigsig, envDuration);
	var sig = Env([0, 1, 0], [0.1, 0.1], [4, -4]).kr(0, envTrig);
	sig
}.plot(1)
)

Best,
Paul

Thanks Paul, so obvious and I missed it…thanks for saving me!