com.frinika.contrib.boblang
Class BezierEnvelopeShaper

java.lang.Object
  extended by com.frinika.contrib.boblang.BezierEnvelopeShaper

public class BezierEnvelopeShaper
extends java.lang.Object

Implements a basic Attack/decay/sustain/release envelope shaper.

Version:
25 Apr 2004
Author:
Bob Lang

Constructor Summary
BezierEnvelopeShaper(BezierParams params)
          Constructor which converts envelope data in the Ant Params object into their equivalent attributes.
 
Method Summary
 double getFactor(int index)
          Get the multiplication factor for the current sample based on its position in the sound wave.
 double getRelFactor(int index, int releaseIndex)
          Get the multiplication factor for the current sample based on its position in the sound wave but assuming it was released at the specified time.
 boolean isNoteFinished(int index, int releaseIndex)
          Return true if the note should have finished by now
 void reshapeEnvelope(BezierParams params)
          Convert the envelope data in the parameter object into equivalent attributes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BezierEnvelopeShaper

public BezierEnvelopeShaper(BezierParams params)
Constructor which converts envelope data in the Ant Params object into their equivalent attributes. In practice, it calls the public method reshapeEnvelope () to allow dynamic envelope changes

Method Detail

reshapeEnvelope

public final void reshapeEnvelope(BezierParams params)
Convert the envelope data in the parameter object into equivalent attributes. This method may be used to dynamically change the envelope, perhaps as a note is playing.


getFactor

public final double getFactor(int index)
Get the multiplication factor for the current sample based on its position in the sound wave. The position is obtained from index and this version of the method assumes that the note has not been released.

If window is non-zero, then the factor is the average value for a window of samples starting at index and of the specified width


getRelFactor

public final double getRelFactor(int index,
                                 int releaseIndex)
Get the multiplication factor for the current sample based on its position in the sound wave but assuming it was released at the specified time.


isNoteFinished

public final boolean isNoteFinished(int index,
                                    int releaseIndex)
Return true if the note should have finished by now