ddf.minim.ugens
Class ADSR

java.lang.Object
  extended by ddf.minim.ugens.UGen
      extended by ddf.minim.ugens.ADSR

public class ADSR
extends UGen

A UGen that plays input audio through a standard ADSR envelope based on time from noteOn and noteOff

Author:
Anderson Mills

Nested Class Summary
 
Nested classes/interfaces inherited from class ddf.minim.ugens.UGen
UGen.InputType, UGen.UGenInput
 
Field Summary
 UGen.UGenInput audio
          The default input is "audio."
You won't need to patch to this directly, since simply patching to the ADSR itself will achieve the same result.
 
Constructor Summary
ADSR()
          Constructor for an ADSR envelope.
ADSR(float maxAmp)
          Constructor for an ADSR envelope with maximum amplitude.
ADSR(float maxAmp, float attTime)
          Constructor for an ADSR envelope with maximum amplitude, attack Time.
ADSR(float maxAmp, float attTime, float decTime)
          Constructor for an ADSR envelope with maximum amplitude, attack Time, and decay time.
ADSR(float maxAmp, float attTime, float decTime, float susLvl)
          Constructor for an ADSR envelope with maximum amplitude, attack Time, decay time, and sustain level.
ADSR(float maxAmp, float attTime, float decTime, float susLvl, float relTime)
          Constructor for an ADSR envelope with maximum amplitude, attack Time, decay time, sustain level, and release time.
ADSR(float maxAmp, float attTime, float decTime, float susLvl, float relTime, float befAmp)
          Constr uctor for an ADSR envelope with maximum amplitude, attack Time, decay time, sustain level, release time, an amplitude before the envelope.
ADSR(float maxAmp, float attTime, float decTime, float susLvl, float relTime, float befAmp, float aftAmp)
          Constructor for an ADSR envelope with maximum amplitude, attack Time, decay time, sustain level, release time, an amplitude before the envelope, and an amplitude after the envelope.
 
Method Summary
 void noteOff()
          Specifies that the ADSR envelope should start the release time.
 void noteOn()
          Speficies that the ADSR envelope should begin.
protected  void sampleRateChanged()
          Use this method to notify the ADSR that the sample rate has changed.
 void setParameters(float maxAmp, float attTime, float decTime, float susLvl, float relTime, float befAmp, float aftAmp)
          Permits the changing of the ADSR parameters.
protected  void uGenerate(float[] channels)
          Implement this method when you extend UGen.
 void unpatchAfterRelease(AudioOutput output)
          Tell the ADSR that it should unpatch itself from the output after the release time.
 
Methods inherited from class ddf.minim.ugens.UGen
addInput, getLastValues, patch, patch, patch, printInputs, removeInput, sampleRate, setSampleRate, tick, unpatch, unpatch
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

audio

public UGen.UGenInput audio
The default input is "audio."
You won't need to patch to this directly, since simply patching to the ADSR itself will achieve the same result.

Constructor Detail

ADSR

public ADSR()
Constructor for an ADSR envelope. Maximum amplitude is set to 1.0. Attack and decay times are set to 1 sec. Sustain level is set to 0.0. Release time is set to 1 sec. Amplitude before and after the envelope is set to 0.


ADSR

public ADSR(float maxAmp)
Constructor for an ADSR envelope with maximum amplitude. Attack and decay times are set to 1 sec. Sustain level is set to 0.0. Release time is set to 1 sec. Amplitude before and after the envelope is set to 0.


ADSR

public ADSR(float maxAmp,
            float attTime)
Constructor for an ADSR envelope with maximum amplitude, attack Time. Decay time is set to 1 sec. Sustain level is set to 0.0. Release time is set to 1 sec. Amplitude before and after the envelope is set to 0.


ADSR

public ADSR(float maxAmp,
            float attTime,
            float decTime)
Constructor for an ADSR envelope with maximum amplitude, attack Time, and decay time. Sustain level is set to 0.0. Release time is set to 1 sec. Amplitude before and after the envelope is set to 0.


ADSR

public ADSR(float maxAmp,
            float attTime,
            float decTime,
            float susLvl)
Constructor for an ADSR envelope with maximum amplitude, attack Time, decay time, and sustain level. Release time is set to 1 sec. Amplitude before and after the envelope is set to 0.


ADSR

public ADSR(float maxAmp,
            float attTime,
            float decTime,
            float susLvl,
            float relTime)
Constructor for an ADSR envelope with maximum amplitude, attack Time, decay time, sustain level, and release time. Amplitude before and after the envelope is set to 0.


ADSR

public ADSR(float maxAmp,
            float attTime,
            float decTime,
            float susLvl,
            float relTime,
            float befAmp)
Constr uctor for an ADSR envelope with maximum amplitude, attack Time, decay time, sustain level, release time, an amplitude before the envelope. Amplitude after the envelope is set to 0.


ADSR

public ADSR(float maxAmp,
            float attTime,
            float decTime,
            float susLvl,
            float relTime,
            float befAmp,
            float aftAmp)
Constructor for an ADSR envelope with maximum amplitude, attack Time, decay time, sustain level, release time, an amplitude before the envelope, and an amplitude after the envelope.

Method Detail

setParameters

public void setParameters(float maxAmp,
                          float attTime,
                          float decTime,
                          float susLvl,
                          float relTime,
                          float befAmp,
                          float aftAmp)
Permits the changing of the ADSR parameters.


noteOn

public void noteOn()
Speficies that the ADSR envelope should begin.


noteOff

public void noteOff()
Specifies that the ADSR envelope should start the release time.


sampleRateChanged

protected void sampleRateChanged()
Use this method to notify the ADSR that the sample rate has changed.

Overrides:
sampleRateChanged in class UGen

unpatchAfterRelease

public void unpatchAfterRelease(AudioOutput output)
Tell the ADSR that it should unpatch itself from the output after the release time.

Parameters:
output - the output this should unpatch itself from

uGenerate

protected void uGenerate(float[] channels)
Description copied from class: UGen
Implement this method when you extend UGen. It will be called when your UGen needs to generate one sample frame of audio. It is expected that you will assign values to the array and not simply modify the existing values. In the case where you write a UGen that takes audio input and modifies it, the pattern to follow is to have the first UGenInput you create be your audio input and then in uGenerate you will use the getLastValues method of your audio UGenInput to retrieve the audio you want to modify, which you will then modify however you need to, assigning the result to the values in channels.

Specified by:
uGenerate in class UGen
Parameters:
channels - an array representing one sample frame.