**Type :** envellope generation

**References :** Posted by James McCartney

**Code :**

dur = duration in samples

midlevel = amplitude at midpoint

beglevel = beginning and ending level (typically zero)

amp = midlevel - beglevel;

rdur = 1.0 / dur;

rdur2 = rdur * rdur;

level = beglevel;

slope = 4.0 * amp * (rdur - rdur2);

curve = -8.0 * amp * rdur2;

...

for (i=0; i<dur; ++i) {

level += slope;

slope += curve;

}

**Comments**

__from__ : krakengore[AT]libero[DOT]it

__comment__ : This parabola approximation seems more like a linear than a parab/expo envelope... or i'm mistaking something but i tryed everything and is only linear.

__from__ : ex0r0x0r[AT]hotmail[DOT]com

__comment__ : slope is linear, but 'slope' is a function of 'curve'. If you imagine you threw a ball upwards, think of 'curve' as the gravity, 'slope' as the vertical velocity, and 'level' as the vertical displacement.

__from__ : asynth(at)io(dot)com

__comment__ : This is not an approximation of a parabola, it IS a parabola.
This entry has become corrupted since it was first posted. Should be:
for (i=0; i<dur; ++i) {
out = level;
level += slope;
slope += curve;
}