|
Sound Byte Libs 0.5.1-340-gab5b79a
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
|
An amplifier: gain, Level and Mod Amt as ports over a linear multiply. More...
An amplifier: gain, Level and Mod Amt as ports over a linear multiply.
A linear multiplier with an exponential Level control, the two modes Moog gave the VCA in 1965 (pp. 203-204): the modulation input is linear, so an envelope's own shape is the loudness curve, and Level is exponential, so the knob is even in dB. Its ports are process() arguments after the frame count, in the order PORTS declares (common/transport.hpp):
The first call with ports arrives at its values at once. Output does not depend on block size: every ramp is a fixed number of frames. In place is fine: out may be in.
#include <vca.hpp>
Public Member Functions | |
| Vca () | |
| Unity gain until ports are given; every scalar port ramps over RAMP_FRAMES. | |
| template<class... Ports> | |
| void | process (const float *in, float *out, uint16_t frames, Ports... ports) |
| One block, the ports in PORTS' order, any trailing ones left off. | |
| void | reset () |
| Every ramp at its target. | |
| float | level_gain () const |
| Level's gain after the taper, where the ramp is now. | |
| float | mod_amount () const |
| Mod Amt, where the ramp is now. | |
| float | gain () const |
| The scalar gain, where the ramp is now, or the last frame of a gain block. | |
Static Public Attributes | |
| static constexpr float | LEVEL_RANGE_DB = 60.0f |
| static constexpr uint16_t | RAMP_FRAMES = 64 |
| static constexpr transport::Port | PORTS [] |
|
inline |
Unity gain until ports are given; every scalar port ramps over RAMP_FRAMES.
Definition at line 52 of file vca.hpp.
References RAMP_FRAMES, and sbl::dsp::Ramp::set_length().
Referenced by process().
|
inline |
One block, the ports in PORTS' order, any trailing ones left off.
gain as a block is used as given; as a scalar it moves to its value over RAMP_FRAMES. Level and Mod Amt are scalars. The first value a port is given jumps. A port left off holds its last value, and ramps in progress continue. In place is fine: out may be in.
| Ports | gain as a block or an arithmetic scalar, then level and mod_amount as scalars |
| in | Input buffer, frames long | |
| [out] | out | Output buffer, frames long |
| frames | Frame count | |
| ports | gain, nominally [0, 1]; level in [0, 1]; mod_amount in [0, 1], clamped. A non-finite scalar gain or mod_amount counts as 0 |
Definition at line 81 of file vca.hpp.
References sbl::math::clamp01(), sbl::math::finite_or(), sbl::transport::fits_v, gain(), sbl::dsp::Ramp::head(), sbl::dsp::Ramp::jump(), sbl::dsp::math::level_gain(), LEVEL_RANGE_DB, mod_amount(), sbl::dsp::Ramp::step(), and Vca().
|
inline |
Every ramp at its target.
Definition at line 117 of file vca.hpp.
References sbl::dsp::Ramp::jump(), and sbl::dsp::Ramp::target().
|
inline |
Level's gain after the taper, where the ramp is now.
Definition at line 124 of file vca.hpp.
References sbl::dsp::Ramp::value().
|
inline |
Mod Amt, where the ramp is now.
Definition at line 126 of file vca.hpp.
References sbl::dsp::Ramp::value().
Referenced by process().
|
inline |
The scalar gain, where the ramp is now, or the last frame of a gain block.
Definition at line 128 of file vca.hpp.
References sbl::dsp::Ramp::value().
Referenced by process().
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
The ports, in the order process() takes them.