zsiciarz / aquila

Aquila is a digital signal processing library for C++11.
http://aquila-dsp.org
MIT License
462 stars 112 forks source link

ADSR envelope #14

Open zsiciarz opened 11 years ago

zsiciarz commented 11 years ago

A useful synthesizer component is Attack-Decay-Sustain-Release (ADSR) envelope.

References:

zsiciarz commented 11 years ago

Idea: write a subclass of SignalSource and reimplement the sample() method:

SampleType ADSR::sample(std::size_t position) const
{
    // calculate gain based on A/D/S/R state and duration progress
    return gain * m_originalSource.sample(position);
}