Lume
    Preparing search index...

    Class ADSREnvelope

    Class for calculating values based off of an ADSR Envelope.

    ADSR Envelopes are treated as percentages, with 1.0 (100%) as the value of the peak, and 0.0 for the value of nil. This is intended to allow for easy usage of lerp functions.

    Index

    Accessors

    Constructors

    Methods

    Accessors

    • get attack(): number

      Returns the time (in milliseconds) that it takes the envelope to go from nil to peak.

      Returns number

      50
      
    • set attack(value: number): void

      Sets the time (in milliseconds) for the envelope's attack value.

      Parameters

      • value: number

      Returns void

      Value must be equal or greater than zero.

    • get decay(): number

      Returns the time (in milliseconds) that it takes the envelope to go from peak to it's sustain level.

      Returns number

      100
      
    • set decay(value: number): void

      Sets the time (in milliseconds) for the envelope's decay value.

      Parameters

      • value: number

      Returns void

      Value must be equal or greater than zero.

    • get release(): number

      Returns the time (in milleseconds) that it takes the envelope to go from the sustain level to nil.

      Returns number

      300
      
    • set release(value: number): void

      Sets the time (in milleseconds) for the envelope's release value.

      Parameters

      • value: number

      Returns void

      Value must be equal or greater than zero.

    • get sustain(): number

      Returns the sustain level of the envelope.

      Sustain level is stored as a percentage, specifically as a number between 0.0 and 1.0 (both inclusive).

      Returns number

      0.5
      
    • set sustain(value: number): void

      Sets the sustain level of the envelope.

      Parameters

      • value: number

      Returns void

      Value must be between 0.0 and 1.0 (both inclusive).

    Constructors

    Methods

    • Calculates a level given the current parameters of a note.

      Parameters

      • isNoteOn: boolean

        If the note being checked is currently active.

      • timeSinceStateChange: number

        The time since the note was last turned on/off.

      Returns number

      TimeSinceStateChange must be equal or greater than zero.