Envelope = function(audiolet, gate, levels, times, releaseStage,
                        onComplete) {
    AudioletNode.call(this, audiolet, 1, 1);
    this.gate = new AudioletParameter(this, 0, gate || 1);

    this.levels = [];
    for (var i=0; i<levels.length; i++) {
        this.levels.push(new AudioletParameter(this, null, levels[i]));
    }

    this.times = [];
    for (var i=0; i<times.length; i++) {
        this.times.push(new AudioletParameter(this, null, times[i]));
    }

    this.releaseStage = releaseStage;
    this.onComplete = onComplete;

    this.stage = null;
    this.time = null;
    this.changeTime = null;

    this.level = this.levels[0].getValue();
    this.delta = 0;
    this.gateOn = false;
}
A generic envelope consisting of linear transitions of varying duration
between a series of values.

**Inputs**

- Gate

**Outputs**

- Envelope

**Parameters**

- gate Gate controlling the envelope.  Values should be 0 (off) or 1 (on).
Linked to input 0.

@constructor
@extends AudioletNode
@param {Audiolet} audiolet The audiolet object.
@param {Number} [gate=1] Initial gate value.
@param {Number[]} levels An array (of length n) of values to move between.
@param {Number[]} times An array of n-1 durations - one for each transition.
@param {Number} [releaseStage] Sustain at this stage until the the gate is 0.
@param {Function} [onComplete] Function called as the envelope finishes.