IADSR


Description

This object generates an attack - decay - sustain - release shaped signal at the output, with initial and end amplitude values. Alternatively, it can similarly shape an input signal, acting as a modifier. The difference between this object and the standard ADSR is that it expects values for the initial and end amplitudes, which in the latter case are always 0. This object can be used to generate envelopes that do not necessarily start and end in 0, such as, a frequency envelope.


Construction

IADSR()
IADSR(float init, float att, float maxamp, float dec, float sus, float rel, float end, float dur, SndObj* InObj = 0, int vecsize=DEF_VECSIZE, float sr=DEF_SR)

Public Methods

void SetInit(float init)
void SetEnd(float end)

virtual short DoProcess()


IADSR()
IADSR( )

These methods construct an object of the IADSR class. Construction parameters are:

float init: initial amplitude.
float att: attack time, or rise time, in secs. Time taken for the signal to change from init to maxamp.
float maxamp: maximum amplitude after rise time. It is a multiplier, in case of the shaping of an input signal.
float dec: decay time, in secs. Time taken for the signal to change from maxamp to sus.&
float sus: sustain amplitude after decay time. Again, a multiplier, in case of envelope shaping. The sustain period is calculated on the basis of the difference between the total duration and the sum of the attack, decay and release times.
float rel: release time, in secs, after the sustain period, during which the signal changes from sus to end. It is calculated backwards from the end, taken from the total duration of the envelope.
float end: end amplitude.
float dur: total duration of the envelope, in secs, or the envelope period. This ADSR is designed to loop, so the whole shape will be repeated after the total duration is completed.

SndObj* InObj: input object, pointer to the location of a SndObj-derived class. Defaults to 0, which means no input object, so the ADSR object is used as a signal generator.

int vecsize: vector size in samples. Size of the internal DSP buffer, defaults to DEF_VECSIZE, 256.
float sr: sampling rate in HZ. Defaults to DEF_SR, 44100.f.


void SetInit(float init)
void SetEnd(float end)

These methods set the parameters that IADSR adds to the ones inherited from its base class, ADSR

float init: initial amplitude.
float end: end amplitude.


SndObj Library version 2.0
© Victor Lazzarini, 2001
Music Technology Laboratory
NUI Maynooth