Class SimpleADSR

java.lang.Object
net.paulhertz.pixelaudio.voices.SimpleADSR

public class SimpleADSR extends Object
SimpleADSR — software envelope generator with optional exponential curves. Features: - Sample-rate–based time scaling - Per-stage exponential curvature - Sustain-level clamping - `noteOn()`, `noteOff()`, `tick()`, and `isFinished()`
  • Field Details

    • attackTime

      private float attackTime
    • decayTime

      private float decayTime
    • sustainLevel

      private float sustainLevel
    • releaseTime

      private float releaseTime
    • sampleRate

      private float sampleRate
    • attackCurve

      private float attackCurve
    • decayCurve

      private float decayCurve
    • releaseCurve

      private float releaseCurve
    • stage

      private SimpleADSR.Stage stage
    • value

      private float value
    • releaseStart

      private float releaseStart
    • samplesInStage

      private int samplesInStage
    • stageSamples

      private int stageSamples
  • Constructor Details

    • SimpleADSR

      public SimpleADSR(float attack, float decay, float sustain, float release)
    • SimpleADSR

      public SimpleADSR(float attack, float decay, float sustain, float release, float attackCurve, float decayCurve, float releaseCurve)
  • Method Details

    • setSampleRate

      public void setSampleRate(float sr)
    • noteOn

      public void noteOn()
    • noteOff

      public void noteOff()
    • isFinished

      public boolean isFinished()
    • tick

      public float tick()
    • exponentialInterp

      private static float exponentialInterp(int step, int total, float start, float end, float curve)
    • getValue

      public float getValue()
    • setCurves

      public void setCurves(float attackC, float decayC, float releaseC)
    • setTimes

      public void setTimes(float a, float d, float s, float r)