Package wellen.dsp

Class ADSR

java.lang.Object
wellen.dsp.ADSR
All Implemented Interfaces:
DSPNodeOutput

public class ADSR extends Object implements DSPNodeOutput
envelope with (A)ttack (D)ecay (S)ustain (R)elease stages: ADSR

it is usually used to control the amplitude of an *oscillator*.


                |-----›|--›|   |--›|
                |---A--|-D-|-S-|-R-|
                |      /\
                |     /  \
                |    /    \_____
                |   /        ^  \
                |  /         |   \
                | /          |    \
                |/___________|_____\
                |
                |Press          |Release
  
  • Field Details

  • Constructor Details

    • ADSR

      public ADSR(int pSamplingRate)
      Parameters:
      pSamplingRate - sampling rate in Hz.
    • ADSR

      public ADSR()
  • Method Details

    • output

      public float output()
      Description copied from interface: DSPNodeOutput
      returns the output signal.
      Specified by:
      output in interface DSPNodeOutput
      Returns:
      current envelope value
    • start

      public void start()
    • stop

      public void stop()
    • get_attack

      public float get_attack()
      Returns:
      attack value in seconds
    • set_attack

      public void set_attack(float pAttack)
      Parameters:
      pAttack - attack value in seconds
    • set_adsr

      public void set_adsr(float pAttack, float pDecay, float pSustain, float pRelease)
      Parameters:
      pAttack - attack value in seconds
      pDecay - decay value in seconds
      pSustain - sustain value in seconds
      pRelease - release value in seconds
    • get_decay

      public float get_decay()
      Returns:
      decay value in seconds
    • set_decay

      public void set_decay(float pDecay)
      Parameters:
      pDecay - decay value in seconds
    • get_sustain

      public float get_sustain()
      Returns:
      sustain value in seconds
    • set_sustain

      public void set_sustain(float pSustain)
      Parameters:
      pSustain - sustain value in seconds
    • get_release

      public float get_release()
      Returns:
      release value in seconds
    • set_release

      public void set_release(float pRelease)
      Parameters:
      pRelease - release value in seconds