ddf.minim.ugens
Class Delay

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

public class Delay
extends UGen

The Delay UGen is used to create delayed repetitions of the input audio. One can control the delay time and amplification of the repetition. One can also choose whether the repetition is fed back and/or the input is passed through.

Author:
J Anderson Mills III

Nested Class Summary
 
Nested classes/interfaces inherited from class ddf.minim.ugens.UGen
UGen.InputType, UGen.UGenInput
 
Field Summary
 UGen.UGenInput audio
          audio is the incoming audio
 UGen.UGenInput delAmp
          delAmp is the strength of each repetition compared to the previous.
 UGen.UGenInput delTime
          delTime is the time for delay between repetitions.
 
Constructor Summary
Delay()
          Constructor for Delay.
Delay(float maxDelayTime)
          Constructor for Delay.
Delay(float maxDelayTime, float amplitudeFactor)
          Constructor for Delay.
Delay(float maxDelayTime, float amplitudeFactor, boolean feedBackOn)
          Constructor for Delay.
Delay(float maxDelayTime, float amplitudeFactor, boolean feedBackOn, boolean passAudioOn)
          Constructor for Delay.
 
Method Summary
protected  void sampleRateChanged()
          When the sample rate is changed the buffer needs to be resized.
 void setDelAmp(float delAmp)
          changes the feedback amplification of the echos.
 void setDelTime(float delTime)
          changes the time in between the echos to the value specified.
protected  void uGenerate(float[] channels)
          Implement this method when you extend UGen.
 
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
audio is the incoming audio


delTime

public UGen.UGenInput delTime
delTime is the time for delay between repetitions.


delAmp

public UGen.UGenInput delAmp
delAmp is the strength of each repetition compared to the previous.

Constructor Detail

Delay

public Delay()
Constructor for Delay.

Parameters:
maxDelayTime - is the maximum delay time for any one echo. This defaults to 0.25s.
amplitudeFactor - is the amplification factor for feedback and should generally be from 0 to 1. This defaults to 0.5.
feedBackOn - is a boolean flag specifying if the repetition continue to feed back. The default value is false.
passAudioOn - is a boolean value specifying whether to pass the input audio to the output as well. This defaults to true.

Delay

public Delay(float maxDelayTime)
Constructor for Delay.

Parameters:
maxDelayTime - is the maximum delay time for any one echo.
amplitudeFactor - is a boolean value specifying whether to pass the input audio to the output as well. This defaults to 0.5.
feedBackOn - is a boolean flag specifying if the repetition continue to feed back. The default value is false.
passAudio - is a boolean value specifying whether to pass the input audio to the output as well. This defaults to true.

Delay

public Delay(float maxDelayTime,
             float amplitudeFactor)
Constructor for Delay.

Parameters:
maxDelayTime - is the maximum delay time for any one echo and the default echo time.
amplitudeFactor - is the amplification factor for feedback and should generally be from 0 to 1.
feedBackOn - is a boolean flag specifying if the repetition continue to feed back. The default value is false.
passAudioOn - is a boolean value specifying whether to pass the input audio to the output as well. This defaults to true.

Delay

public Delay(float maxDelayTime,
             float amplitudeFactor,
             boolean feedBackOn)
Constructor for Delay.

Parameters:
maxDelayTime - is the maximum delay time for any one echo and the default echo time.
amplitudeFactor - is the amplification factor for feedback and should generally be from 0 to 1.
feedBackOn - is a boolean flag specifying if the repetition continue to feed back.
passAudioOn - is a boolean value specifying whether to pass the input audio to the output as well. This defaults to true.

Delay

public Delay(float maxDelayTime,
             float amplitudeFactor,
             boolean feedBackOn,
             boolean passAudioOn)
Constructor for Delay.

Parameters:
maxDelayTime - is the maximum delay time for any one echo and the default echo time.
amplitudeFactor - is the amplification factor for feedback and should generally be from 0 to 1.
feedBackOn - is a boolean flag specifying if the repetition continue to feed back.
passAudioOn - is a boolean value specifying whether to pass the input audio to the output as well.
Method Detail

sampleRateChanged

protected void sampleRateChanged()
When the sample rate is changed the buffer needs to be resized. Currently this causes the allocation of a completely new buffer, but since a change in sampleRate will result in a change in the playback speed of the sound in the buffer, I'm okay with this.

Overrides:
sampleRateChanged in class UGen

setDelTime

public void setDelTime(float delTime)
changes the time in between the echos to the value specified.

Parameters:
delTime - It can be up to the maxDelayTime specified. The lowest it can be is 1/sampleRate.

setDelAmp

public void setDelAmp(float delAmp)
changes the feedback amplification of the echos.

Parameters:
delAmp - This should normally be between 0 and 1 for decreasing feedback. Phase inverted feedback can be generated with negative numbers, but each echa will be the inverse of the one before it.

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.