eDSP
0.0.1
A cross-platform DSP library written in C++.
|
This class implements a basic envelope-follower. More...
#include <envelope_follower.hpp>
Public Types | |
using | value_type = T |
using | size_type = std::size_t |
Public Member Functions | |
constexpr | envelope_follower (value_type samplerate, value_type attackTime, value_type releaseTime, bool rectify=false) noexcept |
Creates an EnvelopeFollower object class. More... | |
constexpr value_type | samplerate () const noexcept |
Returns the sample rate in Hz. More... | |
constexpr void | set_samplerate (value_type samplerate) noexcept |
Sets the sample rate in Hz and resets the internal parameters. More... | |
constexpr value_type | attack_time () const noexcept |
Returns the attack time of the first order lowpass in the attack phase. More... | |
constexpr void | set_attack_time (value_type attackTime) noexcept |
Set the the attack time of the first order lowpass in the attack phase. More... | |
constexpr value_type | release_time () const noexcept |
Returns the release time of the first order lowpass in the release phase. More... | |
constexpr void | set_release_time (value_type releaseTime) noexcept |
Set the the release time of the first order lowpass in the attack phase. More... | |
constexpr bool | rectification () const noexcept |
Checks if the rectification is enabled. More... | |
constexpr void | set_rectification (bool enabled) noexcept |
Enables the rectification of the output signal. More... | |
constexpr void | reset () noexcept |
Resets the temporal an internal data. More... | |
template<typename InIterator , typename OutputIt > | |
constexpr void | apply (InIterator first, InIterator last, OutputIt d_first) |
Computes the envelope of the element's value in the range [first, last), and stores the result in another range, beginning at d_first. More... | |
This class implements a basic envelope-follower.
The envelope follower takes an high-frequency signal as input and provides an output which is the envelope of the original signal. It is frequently used to detect the amplitude variations of an incoming signal to produce a control signal that resembles those variations.
This class implements a basic Envelope Follower based in a non-symmetric lowpass filter. The output of a low-pass filter can be viewed as a moving average of its input. A minimal envelope generator has an attack period, in which the level of the envelope rises from an initial zero level to a maximum level, followed by a release phase,in which the level falls back to zero. *
using edsp::envelope_follower< T >::size_type = std::size_t |
using edsp::envelope_follower< T >::value_type = T |
|
noexcept |
Creates an EnvelopeFollower object class.
samplerate | The sample rate in Hz. |
attackTime | The attack time of the first order lowpass in the attack phase in msecs. |
releaseTime | The release time of the first order lowpass in the attack phase in msecs. |
rectify | If true, enables the rectification of the output signal. |
constexpr void edsp::envelope_follower< T >::apply | ( | InIterator | first, |
InIterator | last, | ||
OutputIt | d_first | ||
) |
Computes the envelope of the element's value in the range [first, last), and stores the result in another range, beginning at d_first.
first | Input iterator defining the beginning of the input range. |
last | Input iterator defining the ending of the input range. |
d_first | Output iterator defining the beginning of the destination range. |
|
noexcept |
Returns the attack time of the first order lowpass in the attack phase.
|
noexcept |
Checks if the rectification is enabled.
|
noexcept |
Returns the release time of the first order lowpass in the release phase.
|
noexcept |
Resets the temporal an internal data.
|
noexcept |
Returns the sample rate in Hz.
|
noexcept |
Set the the attack time of the first order lowpass in the attack phase.
attackTime | Attack time in msecs. |
|
noexcept |
Enables the rectification of the output signal.
If the rectification is enabled, the envelope-follower is based on the absolute value of signal
enabled | State of the rectification. |
|
noexcept |
Set the the release time of the first order lowpass in the attack phase.
releaseTime | Release time in msecs. |
|
noexcept |
Sets the sample rate in Hz and resets the internal parameters.
samplerate | Sample rate in Hz. |