Mozzi  alpha 0.01.1t
sound synthesis library for Arduino
 All Classes Functions Typedefs
Public Member Functions
Ead Class Reference

Exponential attack decay envelope. More...

List of all members.

Public Member Functions

 Ead (unsigned int update_rate)
 Constructor.
void setAttack (unsigned int attack_ms)
 Set the attack time in milliseconds.
void setDecay (unsigned int decay_ms)
 Set the decay time in milliseconds.
void set (unsigned int attack_ms, unsigned int decay_ms)
 Set attack and decay times in milliseconds.
void start ()
 Start the envelope from the beginning.
void start (unsigned int attack_ms, unsigned int decay_ms)
 Set attack and decay times in milliseconds, and start the envelope from the beginning.
unsigned char next ()
 Calculate and return the next envelope value, in the range -128 to 127.

Detailed Description

Exponential attack decay envelope.

This produces a natural sounding envelope. It calculates a new value each time next() is called, which can be mapped to other parameters to change the amplitude or timbre of a sound.

Note:
Currently doesn't work at audio rate... may need larger number types for Q8n8attack and Q8n8decay ?

Definition at line 40 of file Ead.h.


Constructor & Destructor Documentation

Ead::Ead ( unsigned int  update_rate)

Constructor.

Parameters:
update_rateUsually this will be CONTROL_RATE or AUDIO_RATE, unless you design another scheme for updating. One such alternative scheme could take turns for various control changes in a rotating schedule to spread out calculations made in successive updateControl() routines.

Definition at line 29 of file Ead.cpp.


Member Function Documentation

unsigned char Ead::next ( ) [inline]

Calculate and return the next envelope value, in the range -128 to 127.

Note:
Timing: 5us

Definition at line 121 of file Ead.h.

void Ead::set ( unsigned int  attack_ms,
unsigned int  decay_ms 
) [inline]

Set attack and decay times in milliseconds.

Parameters:
attack_msThe time taken for values returned by successive calls of the next() method to change from 0 to 255.
decay_msThe time taken for values returned by successive calls of the next() method to change from 255 to 0.

Definition at line 82 of file Ead.h.

void Ead::setAttack ( unsigned int  attack_ms) [inline]

Set the attack time in milliseconds.

Parameters:
attack_msThe time taken for values returned by successive calls of the next() method to change from 0 to 255.

Definition at line 59 of file Ead.h.

void Ead::setDecay ( unsigned int  decay_ms) [inline]

Set the decay time in milliseconds.

Parameters:
decay_msThe time taken for values returned by successive calls of the next() method to change from 255 to 0.

Definition at line 69 of file Ead.h.

void Ead::start ( ) [inline]

Start the envelope from the beginning.

This can be used at any time, even if the previous envelope is not finished.

Definition at line 92 of file Ead.h.

void Ead::start ( unsigned int  attack_ms,
unsigned int  decay_ms 
) [inline]

Set attack and decay times in milliseconds, and start the envelope from the beginning.

This can be used at any time, even if the previous envelope is not finished.

Parameters:
attack_msThe time taken for values returned by successive calls of the next() method to change from 0 to 255.
decay_msThe time taken for values returned by successive calls of the next() method to change from 255 to 0.

Definition at line 108 of file Ead.h.


The documentation for this class was generated from the following files: