Voltage-controlled amplifier. More...
#include <vca.hpp>
Public Types | |
| using | Response = VcaResponse |
Public Member Functions | |
| void | prepare (SampleType sample_rate) |
| void | set_response (Response r) |
| Response | response () const |
| void | set_range_db (double db) |
| double | range_db () const |
| void | set_lag_ms (double ms) |
| void | reset (SampleType control=SampleType{0}) |
| SampleType | gain_for (SampleType control) const |
| Static response curve, without the lag. | |
| SampleType | next_gain (SampleType control) |
| Advance the lag by one sample and return the gain that would be applied. | |
| SampleType | process (SampleType input, SampleType control) |
| SampleType | control () const |
| The lagged control value, for metering or for driving a second stage from the same conditioned control. | |
Static Public Attributes | |
| static constexpr double | kMinRangeDb = 12.0 |
| Depth of the equal-dB exponential response. | |
| static constexpr double | kMaxRangeDb = 120.0 |
| static constexpr double | kDefaultRangeDb = 60.0 |
| static constexpr double | kDefaultLagMs = 1.0 |
| Default control lag. | |
Voltage-controlled amplifier.
The exponential response is g = (e^(k*c) - 1) / (e^k - 1) with k = 4.6, which spans about 40 dB — enough that the bottom of the control range is perceptually silent without the numerical hazards of an actual log curve. Both responses are exactly 0 at control 0 and exactly 1 at control 1; unity at full is a series law, so a VCA left wide open is bit-transparent rather than approximately transparent.
| using pulp::signal::VcaT< SampleType >::Response = VcaResponse |
|
inline |
The lagged control value, for metering or for driving a second stage from the same conditioned control.
|
inline |
Static response curve, without the lag.
Exposed so a UI can draw the same curve the audio path uses.
|
inline |
Advance the lag by one sample and return the gain that would be applied.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
staticconstexpr |
Default control lag.
Long enough to kill the click from a hard-switched gate, short enough that a percussive envelope keeps its transient.
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
Depth of the equal-dB exponential response.