A one-shot percussion envelope: linear attack ramp, optional hold, then exponential decay.
More...
|
| | DecayEnvelopeT () |
| | A default-constructed envelope has usable coefficients at 44.1 kHz, so triggering one before any setter runs produces the documented default contour rather than instant silence.
|
| void | set_sample_rate (double sr) |
| void | set_attack_ms (double ms) |
| | Length of the anti-click ramp.
|
| void | set_hold_ms (double ms) |
| | Time at full scale between the attack and the decay.
|
| void | set_decay_time_constant_ms (double ms) |
| | Decay expressed as an RC time constant (1/e after ms).
|
| void | set_decay_t60_ms (double ms) |
| | Decay expressed as a T60 (-60 dB after ms).
|
| double | attack_ms () const |
| double | hold_ms () const |
| double | decay_ms () const |
| void | trigger (SampleType peak=SampleType{1}) |
| | Starts the envelope from silence.
|
| void | reset () |
| | Silences the envelope immediately without a release ramp.
|
| bool | is_active () const |
| SampleType | process () |
| | Next envelope sample in [0, peak].
|
| SampleType | value () const |
| | Current level without advancing, scaled by the trigger peak.
|
template<typename SampleType = float>
class pulp::signal::DecayEnvelopeT< SampleType >
A one-shot percussion envelope: linear attack ramp, optional hold, then exponential decay.
The attack ramp exists to stop a click. Starting an envelope at full scale puts a step edge into the signal, which is broadband and lands on top of whatever transient the voice was designed to have. A ramp of a fraction of a millisecond removes the step without softening the attack audibly, so the default is deliberately short rather than musically chosen.
The decay is exponential and never reaches zero analytically, so the envelope declares itself finished once it falls below silence_floor and then outputs exact zero. A voice polls is_active() to know when it can stop rendering, which is what keeps an idle drum kit off the CPU.
The decay time may be expressed either as an RC time constant (set_decay_time_constant_ms) or as a T60 (set_decay_t60_ms); the two setters are alternatives, and the most recent call wins.
RT contract: every member allocates nothing and takes no locks.