Clicking envelope when using gates of different heights

This patch is a sequencer that controls the gate height of the clock coming through it to add dynamics to envelopes.

I noticed something while building - the envelopes will click if the envelopes don’t have time to go through their entire cycle. The post contains an example of this at the bottom under Demos.

So what I’m asking here is for help solving this problem:

Should there just be a touch of slew limiting on every envelope module to prevent this from happening? I don’t know if it’s something that can be fixed other than doing this.

The amount would be so little that it wouldn’t compromise snappiness, but I wanted to ask people’s opinions about it first before going in and changing them all.

A touch of slew also works.

1 Like

I think I would leave the envelopes unmodified. You can always add some slew limiting if needed. There may be instances where you want the envelope to change abruptly.

@stschoen do you think this is a bug or the intended behavior?

As you know, any time the value an envelope modulating level changes abruptly, you are likely to get a click. Even the built in ADSR clicks if the attack or decay is set to zero. I think that this is acceptable behavior because there are instances where you may be using the envelope to modulate a value other than amplitude and want the attack or decay as short as possible. It’s always possible to either adjust the value or add some slew limiting. I guess the real question is what behavior should an envelope exhibit if the gate value changes, but does not return to zero and what should happen if an envelope is retriggered before it has completed. If you allow the EG to vary with the gate then if a gate changes abruptly but does not return to zero the output of the EG will also change abruptly. The same is true if the EG is retriggered while the decay value is non-zero and the EG abruptly returns to zero to start the new envelope. The last couple of EG’s I’ve done capture the height of the initial trigger and calculate the heights of the remaining steps from this value. After the capture, the value of the gate is ignored until the gate returns to zero at which time the decay phase begins. If the EG is retriggered, the new attack begins at the current value rather than returning to zero. The EG waveform remains stable and varies only in proportion to the initial gate value. This prevents unintentional abrupt shifts in the output of the EG while still allowing rapid changes when required. An alternative approach to retriggering is to add the new envelope to the current value housing the attack value to increase if the envelope is retriggered early, but I didn’t find that particularly useful.

Can you upload an example of this? It might be a great solution if it’s not too CPU-hungry.

I’m thinking of the end user and people who might want to do dynamic playing but don’t understand what’s happening with the envelopes and why they click. If we add just a tiny bit of slew (as there is in the demo patch on the sequencer I uploaded), then it solves it without sacrificing envelope speed.

I guess my question here is this needs a solution, but what would the best solution be?

The Audulus ADSR node exhibits both behaviors I described. When re-triggered before the end of the decay, it does not return to zero. It also captures the initial gate height and does not change its output if the gate changes after the initial trigger (other than when the gate returns to zero). I disagree that the click caused by a “zero” attack, decay or release value needs to be fixed. Essentially, by adding a slew limiter you are forcing these values to be non-zero and changing a linear slope into a hyperbolic one. This is not necessarily a bad thing, but I think it should be left to the user. If you feel that it must be fixed, rather than use a slew limiter, I would re-scale the values so they have a minimum greater than zero. This leaves the linear curves unchanged and does not introduce any additional overhead. The AD envelope @RobertSyrett used in his filter-based example does vary with changing gate heights. 8 Step Advanced Sequencer. Here’s a variant that doesn’t:gate variation and re-trigger.audulus (86.3 KB)

2 Likes

I’m going to change my mind (one of the benefits of being an old fart!) I’ve decided that if you feel that fixing is required, the slew limiter is the better way to go. It does introduce some additional overhead, but affects the overall envelope less. Either that or put up a post “Those Pesky Clicks and What to Do About Them”

1 Like

The zero attack click isn’t really a problem, it’s that the ADSR node by itself apparently doesn’t support dynamic retriggering like the kind done with this sequencer. I agree the ADSR node should be left alone but Im thinking the modules need to have a touch of slew to prevent this. Sounds like you’re on board with that?

I think the problem generally with the legato envelope is that a soft note following a loud note cuts off the decay with zero time, creating a click in the middle of the sound, right? That transcends this specific sequencer.

The adsr node is effectively multiplying the envelope by the level of the gate. You can compare this with the regular envelope multiplies by a random stepped signal tied to the same clock.

running the adsr through a lowpass filter does remove the clicks, and running the stepped volume information through low pass slew creates a slightly different effect.

adsr with slew test…audulus (560.2 KB)

What I think could be an improvement to the node would be to add a minimum decay rate less than zero but just for falling envelopes being retriggered. Zero onset attacks are great for percussion, but I can’t think of a time when I wanted click on a decay, but that behavior could be preserved by multiplying the envelope signal with the stepped volume signal.

If I remember correctly this type of clicking due to a decay being cut off is what gave the minilogue a bad rap initially until they patched it with firmware.

1 Like

OK now I get it (I think). The problem you’re describing occurs when a quiet note immediately follows a loud one causing a retrigger but the initial gate is lower than the decay at the time of the retrigger. Damn, another mod. I’ll have to fix the generator I just posted (right after dinner!)

2 Likes

OK I fixed the retrigger bug (I hope) This one is not particularly light on CPU, but it does have adjustable curves on the ramps, and adjustable attack, sustain and decay levels as well as times, so you can have multistage attacks or even inverted envelopes. Variable Curve ADSR Envelope Generator I don’t think it will click given the decay and retrigger logic.

1 Like