Analog-modeled ADSR envelope generator for smooth, musical envelopes.
More...
#include <gin_analogadsr.h>
Analog-modeled ADSR envelope generator for smooth, musical envelopes.
AnalogADSR provides an envelope generator that emulates the behavior of analog synthesizer envelopes with smooth, exponential curves. It's ideal for controlling audio levels (amplitude envelopes) and produces more natural-sounding results than linear envelopes.
Based on the ADSR implementation from Will Pirkle's book "Designing Software
Synthesizer Plug-Ins in C++".
Key Features:
- Exponential attack, decay, and release curves (analog-like)
- Per-sample or block processing
- Can fill buffer with envelope values or multiply existing audio
- State tracking (idle, attack, decay, sustain, release)
- Reset capability for retriggering
Envelope Stages:
- Attack: Time to rise from 0 to peak (1.0)
- Decay: Time to fall from peak to sustain level
- Sustain: Held level while note is on (0.0 to 1.0)
- Release: Time to fall from current level to 0 after note off
Usage:
void processMultiplying(juce::AudioSampleBuffer &buffer)
void setDecay(float seconds)
void setAttack(float seconds)
void setSustainLevel(float level)
void setSampleRate(double sr)
Definition gin_analogadsr.h:73
void setRelease(float seconds)
- See also
- ADSR
◆ State
| Enumerator |
|---|
| idle | |
| attack | |
| decay | |
| sustain | |
| release | |
◆ AnalogADSR()
| AnalogADSR::AnalogADSR |
( |
| ) |
|
◆ ~AnalogADSR()
| AnalogADSR::~AnalogADSR |
( |
| ) |
|
|
default |
◆ setSampleRate()
| void AnalogADSR::setSampleRate |
( |
double | sr | ) |
|
◆ process() [1/4]
| float AnalogADSR::process |
( |
| ) |
|
◆ process() [2/4]
| float AnalogADSR::process |
( |
int | num | ) |
|
◆ process() [3/4]
| void AnalogADSR::process |
( |
juce::AudioSampleBuffer & | buffer | ) |
|
◆ process() [4/4]
| void AnalogADSR::process |
( |
juce::AudioSampleBuffer & | buffer, |
|
|
int | startSample, |
|
|
int | numSamples ) |
◆ processMultiplying() [1/2]
| void AnalogADSR::processMultiplying |
( |
juce::AudioSampleBuffer & | buffer | ) |
|
◆ processMultiplying() [2/2]
| void AnalogADSR::processMultiplying |
( |
juce::AudioSampleBuffer & | buffer, |
|
|
int | startSample, |
|
|
int | numSamples ) |
◆ getOutput()
| float AnalogADSR::getOutput |
( |
| ) |
|
◆ getState()
| State AnalogADSR::getState |
( |
| ) |
|
◆ noteOn()
| void AnalogADSR::noteOn |
( |
| ) |
|
◆ noteOff()
| void AnalogADSR::noteOff |
( |
| ) |
|
◆ setAttack()
| void AnalogADSR::setAttack |
( |
float | seconds | ) |
|
◆ setDecay()
| void AnalogADSR::setDecay |
( |
float | seconds | ) |
|
◆ setRelease()
| void AnalogADSR::setRelease |
( |
float | seconds | ) |
|
◆ setSustainLevel()
| void AnalogADSR::setSustainLevel |
( |
float | level | ) |
|
◆ reset()
| void AnalogADSR::reset |
( |
| ) |
|
◆ getCurrentPhase()
| std::pair< int, float > AnalogADSR::getCurrentPhase |
( |
| ) |
|
◆ calculateAttack()
| void AnalogADSR::calculateAttack |
( |
| ) |
|
|
protected |
◆ calculateDecay()
| void AnalogADSR::calculateDecay |
( |
| ) |
|
|
protected |
◆ calculateRelease()
| void AnalogADSR::calculateRelease |
( |
| ) |
|
|
protected |
◆ state
◆ sampleRate
| double AnalogADSR::sampleRate = 44100.0 |
|
protected |
◆ attack
| float AnalogADSR::attack = 0.0f |
|
protected |
◆ decay
| float AnalogADSR::decay = 0.0f |
|
protected |
◆ sustain
| float AnalogADSR::sustain = 0.0f |
|
protected |
◆ release
| float AnalogADSR::release = 0.0f |
|
protected |
◆ attackCoeff
| float AnalogADSR::attackCoeff = 0.0f |
|
protected |
◆ decayCoeff
| float AnalogADSR::decayCoeff = 0.0f |
|
protected |
◆ releaseCoeff
| float AnalogADSR::releaseCoeff = 0.0f |
|
protected |
◆ attackOffset
| float AnalogADSR::attackOffset = 0.0f |
|
protected |
◆ decayOffset
| float AnalogADSR::decayOffset = 0.0f |
|
protected |
◆ releaseOffset
| float AnalogADSR::releaseOffset = 0.0f |
|
protected |
◆ output
| float AnalogADSR::output = 0.0f |
|
protected |
The documentation for this class was generated from the following file: