Attack is linear, and when you know the velocities for each of the 127 settings you can calculate the time it will take to go from any given starting point to any given ending point using any of the “Attack Time” values. It doesn’t depend on anything else.

Similarly, Decay 2 is an exponential curve and, again, once you know the factors for each of the 127 “Decay 2 Time” values you can similarly derive how long it will take to go from X to Y with any given “Decay 2 Time” setting. It doesn’t depend on anything else.

Release: Same story, or so I currently believe (haven’t fully verified).

Decay 1 however behaves strangely and I am having a tough time modeling the envelope with it.

As an example, start with the following envelope:

Init: 127

Atk Level: 127

Atk Time: 0

Dec1 Level: 0

Dec1 Time: 82

Dec2 Level 127

Dec2 Time: 0

The resulting WAV will start at 0.71217286586761475 for 2 samples (at 44.1kHz), the

__Decay 1__section will drop down from there to 0.00002264976501465 over a period of 3.69922902494161709 seconds, and then quickly shoot back up to 0.71217286586761475 during the Decay 2 phase.

Since it is an exponential decay, we can derive that the decay factor is 0.99993651967393571 (IE, the current level is multiplied by 0.99993651967393571 on each sample, starting from 0.71217286586761475, and doing this multiply over and over will cause the current level to reach 0.00002264976501465 over a period of 3.69922902494161709 seconds).

Sound great! If I know the decay factor, I should be able to derive all the times it takes to go from X to Y at any given “Decay 1 Time” value, just as I have done with Decay 2, Release, and Attack.

Except no. Unlike the other envelope sections, this one somehow depends on neighboring envelope sections.

Take this modified envelope:

Init: 127

Atk Level: 127

Atk Time: 0

Dec1 Level: 0

Dec1 Time: 82

Dec2 Level

**90**

Dec2 Time: 0

I’ve not modified the Decay 1 section, but simply reduced the Decay

*2*section volume by ~50.2201%. This shouldn’t have an impact on the Decay 1 section, but the results suggest otherwise:

*Now*the WAV data starts at 0.71217286586761475 for 2 samples (at 44.1kHz), the

__Decay 1__section drops to

**0.00002014636993408**(which is less than 0.00002264976501465 from before), and it takes

**12.33197278910091832**seconds to do so. It then rises up to ~50.2201% of the original level during the Decay 2 phase.

This means the Decay 1 factor has changed to 0.99998074240248958, even though actually the Decay 1 section has not changed.

So apparently the Decay 1 section depends on at least the Decay 2 section. Probably the attack section as well but these tables take time to generate and I am not there yet.

Can I get some insight into this? How is the Decay 1 section handled?

Is there perhaps some kind of cubic polynomial smoothing just in that section? http://www.montana.edu/rmaher/publications/maher_jaes_1291_934-944.pdf

https://www.musicdsp.org/en/latest/Synthesis/15-cubic-polynomial-envelopes.html

If it is, these are significantly trickier to derive the necessary factors for me to be able to make predictions about the durations and levels from, so would it be possible to get a helping hand in that area?

If it is not, what can anyone tell me about this?

Thank you,

L. Spiro