Digital model of the Moog® Minimoog® Model D VCA circuit.
This model extends the original circuit allowing you to control the power supply voltage, gives you the possibility to control contour and loudness via either parameters or audio-rate input signals, and adds an input bias parameter.
Version: 1.0.0
License: proprietary license
We can privately hand you one or more example plugins if you are interested.
Module type: DSP
typedef struct bwp_mini_vca_coeffs bwp_mini_vca_coeffs;
Coefficients and related.
typedef struct bwp_mini_vca_state bwp_mini_vca_state;
Internal state and related.
static inline void bwp_mini_vca_init(
bwp_mini_vca_coeffs * BW_RESTRICT coeffs);
Initializes input parameter values in coeffs.
static inline void bwp_mini_vca_set_sample_rate(
bwp_mini_vca_coeffs * BW_RESTRICT coeffs,
float sample_rate);
Sets the sample_rate (Hz) value in coeffs.
static inline void bwp_mini_vca_reset_coeffs(
bwp_mini_vca_coeffs * BW_RESTRICT coeffs);
Resets coefficients in coeffs to assume their target values.
static inline float bwp_mini_vca_reset_state(
const bwp_mini_vca_coeffs * BW_RESTRICT coeffs,
bwp_mini_vca_state * BW_RESTRICT state,
float x_0,
float x_contour_0,
float x_loudness_0);
Resets the given state to its initial values using the given coeffs and the initial input value x_0, contour input value x_contour_0, and loudness input value x_loudness_0.
Returns the corresponding initial output value.
If contour input is not enabled, x_contour_0 is ignored. Likewise, if loudness input is not enabled, x_loudness_0 is ignored.
static inline void bwp_mini_vca_reset_state_multi(
const bwp_mini_vca_coeffs * BW_RESTRICT coeffs,
bwp_mini_vca_state * BW_RESTRICT const * BW_RESTRICT state,
const float * x_0,
const float * x_contour_0,
const float * x_loudness_0,
float * y_0,
size_t n_channels);
Resets each of the n_channels states to its initial values using the given coeffs and the corresponding initial input value in the x_0 array, contour input value in the x_contour_0 array, and loudness input value in the x_loudness_0 array.
The corresponding initial output values are written into the y_0 array, if not BW_NULL.
If contour input is not enabled, x_contour_0 is ignored and can be BW_NULL. Likewise, if loudness input is not enabled, x_loudness_0 is ignored and can be BW_NULL.
static inline void bwp_mini_vca_update_coeffs_ctrl(
bwp_mini_vca_coeffs * BW_RESTRICT coeffs);
Triggers control-rate update of coefficients in coeffs.
static inline void bwp_mini_vca_update_coeffs_audio(
bwp_mini_vca_coeffs * BW_RESTRICT coeffs);
Triggers audio-rate update of coefficients in coeffs.
static inline float bwp_mini_vca_process1(
const bwp_mini_vca_coeffs * BW_RESTRICT coeffs,
bwp_mini_vca_state * BW_RESTRICT state,
float x);
static inline float bwp_mini_vca_process1_contour_in(
const bwp_mini_vca_coeffs * BW_RESTRICT coeffs,
bwp_mini_vca_state * BW_RESTRICT state,
float x,
float x_contour);
static inline float bwp_mini_vca_process1_loudness_in(
const bwp_mini_vca_coeffs * BW_RESTRICT coeffs,
bwp_mini_vca_state * BW_RESTRICT state,
float x,
float x_loudness);
static inline float bwp_mini_vca_process1_contour_in_loudness_in(
const bwp_mini_vca_coeffs * BW_RESTRICT coeffs,
bwp_mini_vca_state * BW_RESTRICT state,
float x,
float x_contour,
float x_loudness);
These functions process one input sample x using coeffs, while using and updating state. They return the corresponding output sample.
In particular:
bwp_mini_vca_process1() assumes that contour input and loudness input are not enabled;bwp_mini_vca_process1_contour_in() assumes that contour input is enabled and x_contour is the corresponding input sample, while loudness input is not enabled;bwp_mini_vca_process1_loudness_in() assumes that contour input is not enabled, while loudness input is enabled and x_loudness is the corresponding input sample;bwp_mini_vca_process1_contour_in_loudness_in() assumes that both contour and loudness inputs are enabled, with x_contour and x_loudness being the corresponding input samples, respectively.Such assumptions are unchecked even for debugging purposes.
static inline void bwp_mini_vca_process(
bwp_mini_vca_coeffs * BW_RESTRICT coeffs,
bwp_mini_vca_state * BW_RESTRICT state,
const float * x,
const float * x_contour,
const float * x_loudness,
float * y,
size_t n_samples);
Processes the first n_samples of the input buffer x and the corresponding contour input buffer x_contour and loudness input buffer x_loudness, and fills the first n_samples of the output buffer y, while using and updating both coeffs and state (control and audio rate).
If contour input is not enabled, x_contour is ignored and can be BW_NULL. Likewise, if loudness input is not enabled, x_loudness is ignored and can be BW_NULL.
static inline void bwp_mini_vca_process_multi(
bwp_mini_vca_coeffs * BW_RESTRICT coeffs,
bwp_mini_vca_state * BW_RESTRICT const * BW_RESTRICT state,
const float * const * x,
const float * const * x_contour,
const float * const * x_loudness,
float * const * y,
size_t n_channels,
size_t n_samples);
Processes the first n_samples of the n_channels input buffers x, the contour input buffers x_contour and the loudness input buffers x_loudness, and fills the first n_samples of the n_channels output buffers y, while using and updating both the common coeffs and each of the n_channels states (control and audio rate).
If contour input is not enabled, x_contour is ignored and can be BW_NULL. Likewise, if loudness input is not enabled, x_loudness is ignored and can be BW_NULL.
static inline void bwp_mini_vca_set_contour_in(
bwp_mini_vca_coeffs * BW_RESTRICT coeffs,
char value);
Sets whether contour input is enabled (value non-0) or not (0) in coeffs.
Default value: non-0 (enabled).
static inline void bwp_mini_vca_set_contour(
bwp_mini_vca_coeffs * BW_RESTRICT coeffs,
float value);
Sets the input contour voltage value (V) in coeffs when contour input is not enabled.
Valid range: [0.f, 15.f].
Default value: 10.f.
static inline void bwp_mini_vca_set_loudness_in(
bwp_mini_vca_coeffs * BW_RESTRICT coeffs,
char value);
Sets whether loudness input is enabled (value non-0) or not (0) in coeffs.
Default value: 0 (not enabled).
static inline void bwp_mini_vca_set_loudness(
bwp_mini_vca_coeffs * BW_RESTRICT coeffs,
float value);
Sets the input loudness voltage value (V) in coeffs when loudness input is not enabled.
Valid range: [0.f, 15.f].
Default value: 10.f.
static inline void bwp_mini_vca_set_Vcc(
bwp_mini_vca_coeffs * BW_RESTRICT coeffs,
float value);
Sets the power supply voltage value (V) in coeffs.
Valid range: [5.f, 15.f].
Default value: 10.f.
static inline void bwp_mini_vca_set_bias(
bwp_mini_vca_coeffs * BW_RESTRICT coeffs,
float value);
Sets the input bias voltage value (V) in coeffs.
Valid range: [-0.1f, 0.1f].
Default value: 0.f.
static inline char bwp_mini_vca_coeffs_is_valid(
const bwp_mini_vca_coeffs * BW_RESTRICT coeffs);
Tries to determine whether coeffs is valid and returns non-0 if it seems to be the case and 0 if it is certainly not. False positives are possible, false negatives are not.
coeffs must at least point to a readable memory block of size greater than or equal to that of bwp_mini_vca_coeffs.
static inline char bwp_mini_vca_state_is_valid(
const bwp_mini_vca_coeffs * BW_RESTRICT coeffs,
const bwp_mini_vca_state * BW_RESTRICT state);
Tries to determine whether state is valid and returns non-0 if it seems to be the case and 0 if it is certainly not. False positives are possible, false negatives are not.
If coeffs is not BW_NULL extra cross-checks might be performed (state is supposed to be associated to coeffs).
state must at least point to a readable memory block of size greater than or equal to that of bwp_mini_vca_state.
template<size_t N_CHANNELS = 1>
class MiniVCA {
public:
MiniVCA();
void setSampleRate(
float sampleRate);
void reset(
float x0 = 0.f,
float xContour0 = 0.f,
float xLoudness0 = 0.f,
float * BW_RESTRICT y0 = BW_NULL);
# ifndef BW_CXX_NO_ARRAY
void reset(
float x0,
float xContour0,
float xLoudness0,
std::array<float, N_CHANNELS> * BW_RESTRICT y0);
# endif
void reset(
const float * x0,
const float * xContour0,
const float * xLoudness0,
float * y0 = BW_NULL);
# ifndef BW_CXX_NO_ARRAY
void reset(
std::array<float, N_CHANNELS> x0,
std::array<float, N_CHANNELS> xContour0,
std::array<float, N_CHANNELS> xLoudness0,
std::array<float, N_CHANNELS> * BW_RESTRICT y0 = BW_NULL);
# endif
void process(
const float * const * x,
const float * const * xContour,
const float * const * xLoudness,
float * const * y,
size_t nSamples);
# ifndef BW_CXX_NO_ARRAY
void process(
std::array<const float *, N_CHANNELS> x,
std::array<const float *, N_CHANNELS> xContour,
std::array<const float *, N_CHANNELS> xLoudness,
std::array<float *, N_CHANNELS> y,
size_t nSamples);
# endif
void setContourIn(
bool value);
void setContour(
float value);
void setLoudnessIn(
bool value);
void setLoudness(
float value);
void setVcc(
float value);
void setBias(
float value);
...
}