|
Sound Byte Libs 29c5ff3
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
|
#include <envelope_follower.hpp>
Public Member Functions | |
| void | set_times (float attack_ms, float release_ms, uint32_t sample_rate) |
| Set attack and release times in milliseconds. | |
| void | set_coefficients (float attack, float release) |
| Set attack and release coefficients directly. | |
| float | process (float sample) |
| Process a single sample, return envelope value. | |
| void | process (const float *in, float *out, uint16_t frames) |
| Process a block, write envelope to output buffer. | |
| float | value () const |
| Current envelope value (can be read without processing) | |
| void | reset () |
| Reset envelope state to zero. | |
| void | reset (float initial) |
| Reset envelope state to a specific value. | |
Definition at line 23 of file envelope_follower.hpp.
|
inline |
Process a block, write envelope to output buffer.
Input and output can be the same buffer (in-place).
| in | Input audio buffer |
| out | Output envelope buffer (always >= 0) |
| frames | Number of samples |
Definition at line 105 of file envelope_follower.hpp.
References process().
|
inline |
Process a single sample, return envelope value.
Full-wave rectifies the input, then applies asymmetric smoothing: if |input| > state: use attack coefficient (rise fast) if |input| < state: use release coefficient (fall slow)
| sample | Input audio sample |
Definition at line 85 of file envelope_follower.hpp.
Referenced by process().
|
inline |
Reset envelope state to zero.
Definition at line 115 of file envelope_follower.hpp.
|
inline |
Reset envelope state to a specific value.
Definition at line 118 of file envelope_follower.hpp.
|
inline |
Set attack and release coefficients directly.
Coefficient range [0.0, 1.0). Higher = faster response. 0.0 = no change (hold forever), approaching 1.0 = instant.
| attack | Attack coefficient |
| release | Release coefficient |
Definition at line 70 of file envelope_follower.hpp.
|
inline |
Set attack and release times in milliseconds.
Computes one-pole coefficients from time constants. Attack: how fast the follower rises to meet a transient. Release: how fast it falls after the signal drops.
| attack_ms | Attack time in milliseconds (typically 0.1–10) |
| release_ms | Release time in milliseconds (typically 50–500) |
| sample_rate | Audio sample rate (e.g. 48000) |
Definition at line 38 of file envelope_follower.hpp.
|
inline |
Current envelope value (can be read without processing)
Definition at line 112 of file envelope_follower.hpp.