com.jsyn.unitgen
Class RaisedCosineEnvelope

java.lang.Object
  extended by com.jsyn.unitgen.GrainCommon
      extended by com.jsyn.unitgen.RaisedCosineEnvelope
All Implemented Interfaces:
GrainEnvelope

public class RaisedCosineEnvelope
extends GrainCommon
implements GrainEnvelope

An envelope that can be used in a GrainFarm to shape the amplitude of a Grain. The envelope starts at 0.0, rises to 1.0, then returns to 0.0 following a cosine curve.

 output = 0.5 - (0.5 * cos(phase))
 

See Also:
GrainFarm

Constructor Summary
RaisedCosineEnvelope()
           
 
Method Summary
 boolean hasMoreValues()
          Are there any more values to be generated in the envelope?
 double next()
           
 void reset()
          Reset the envelope back to the beginning.
 void setDuration(double duration)
           
 
Methods inherited from class com.jsyn.unitgen.GrainCommon
getFrameRate, setFrameRate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.jsyn.unitgen.GrainEnvelope
getFrameRate, setFrameRate
 

Constructor Detail

RaisedCosineEnvelope

public RaisedCosineEnvelope()
Method Detail

next

public double next()
Specified by:
next in interface GrainEnvelope
Returns:
next value of the envelope.

hasMoreValues

public boolean hasMoreValues()
Description copied from interface: GrainEnvelope
Are there any more values to be generated in the envelope?

Specified by:
hasMoreValues in interface GrainEnvelope
Returns:
true if there are more envelope values left.

reset

public void reset()
Reset the envelope back to the beginning.

Specified by:
reset in interface GrainEnvelope
Overrides:
reset in class GrainCommon

setDuration

public void setDuration(double duration)
Specified by:
setDuration in interface GrainEnvelope
Parameters:
duration - in seconds.