|
DSPark 1.9.0
Header-only C++20 DSP for real-time and offline audio
|
How sudden the signal is, 0..1, whatever its level. More...
#include <EnvelopeFollower.h>
Public Member Functions | |
| TransientFollower () noexcept | |
| void | prepare (double sampleRate) noexcept |
| Prepares for a sample rate (an invalid one is ignored) and clears. | |
| void | reset () noexcept |
| Clears the followers and the output. | |
| void | setRange (T dB) noexcept |
| Range in dB that maps to the full value, 3 to 40 (default 12). | |
| void | setHold (T ms) noexcept |
| Time the value is held at a peak, 0 to 500 ms (default 20). | |
| void | setRelease (T ms) noexcept |
| Time constant of the fall after the hold, 1 to 2000 ms (default 80). | |
| T | getRange () const noexcept |
| T | getHold () const noexcept |
| T | getRelease () const noexcept |
| T | getValue () const noexcept |
| The value after the last sample (any thread). | |
| T | processSample (T input) noexcept |
| One sample (already the loudest channel's, or mono); returns the value. | |
| void | processBlock (AudioBufferView< T > buffer, T *out=nullptr) noexcept |
| Follows a block (the loudest channel per frame); the audio is not touched. | |
How sudden the signal is, 0..1, whatever its level.
The loudest channel's analytic magnitude (a zero-latency Hilbert pair: a steady tone reads its amplitude with no ripple) feeds two followers with the same release (100 ms): one with a fast attack (0.5 ms), one with a slow attack (30 ms). On a steady signal the two meet; at an onset the fast one leaves the slow one behind by as many decibels as the onset rises, for as long as the slow attack takes. That distance, less half a decibel, over the range (setRange(), 12 dB by default) is the raw value; the output takes it at once, holds it (setHold(), 20 ms) and then falls with a release (setRelease(), 80 ms). Both followers scale with the signal, so the value does not depend on the level (under -120 dBFS it is 0).
Threading: prepare() and reset() on the setup thread or the stream owner; processBlock() and processSample() on the audio thread; the setters and getValue() from any thread.
| T | Sample type (float or double). |
Definition at line 320 of file EnvelopeFollower.h.
|
inlinenoexcept |
Definition at line 323 of file EnvelopeFollower.h.
|
inlinenoexcept |
Definition at line 365 of file EnvelopeFollower.h.
|
inlinenoexcept |
Definition at line 364 of file EnvelopeFollower.h.
|
inlinenoexcept |
Definition at line 366 of file EnvelopeFollower.h.
|
inlinenoexcept |
The value after the last sample (any thread).
Definition at line 369 of file EnvelopeFollower.h.
|
inlinenoexcept |
Prepares for a sample rate (an invalid one is ignored) and clears.
Definition at line 326 of file EnvelopeFollower.h.
|
inlinenoexcept |
Follows a block (the loudest channel per frame); the audio is not touched.
| buffer | The audio to follow (up to 16 channels are read). |
| out | Optional: receives the value per frame (one per sample of the block). |
Definition at line 387 of file EnvelopeFollower.h.
|
inlinenoexcept |
One sample (already the loudest channel's, or mono); returns the value.
Definition at line 372 of file EnvelopeFollower.h.
|
inlinenoexcept |
Clears the followers and the output.
Definition at line 338 of file EnvelopeFollower.h.
|
inlinenoexcept |
Time the value is held at a peak, 0 to 500 ms (default 20).
Definition at line 354 of file EnvelopeFollower.h.
|
inlinenoexcept |
Range in dB that maps to the full value, 3 to 40 (default 12).
Definition at line 349 of file EnvelopeFollower.h.
|
inlinenoexcept |
Time constant of the fall after the hold, 1 to 2000 ms (default 80).
Definition at line 359 of file EnvelopeFollower.h.