Digital model of the Roland® Juno-60® chorus circuit.
Version: 1.1.0
License: proprietary license
Requires:
We can privately hand you one or more example plugins if you are interested.
Module type: DSP
typedef struct bwp_hera_chorus_coeffs bwp_hera_chorus_coeffs;
Coefficients and related.
typedef struct bwp_hera_chorus_state bwp_hera_chorus_state;
Internal state and related.
static inline void bwp_hera_chorus_init(
bwp_hera_chorus_coeffs * BW_RESTRICT coeffs,
uint64_t * BW_RESTRICT rand_state);
Initializes input parameter values and sets the rand_state
pointer for noise generation in coeffs
.
static inline void bwp_hera_chorus_set_sample_rate(
bwp_hera_chorus_coeffs * BW_RESTRICT coeffs,
float sample_rate);
Sets the sample_rate
(Hz) value in coeffs
.
sample_rate
must be greater than or equal to 44100.f
. Using a value greater than or equal to ``88200.f` is however suggested for high fidelity.
static inline void bwp_hera_chorus_reset_coeffs(
bwp_hera_chorus_coeffs * BW_RESTRICT coeffs);
Resets coefficients in coeffs
to assume their target values.
static inline void bwp_hera_chorus_reset_state(
const bwp_hera_chorus_coeffs * BW_RESTRICT coeffs,
bwp_hera_chorus_state * BW_RESTRICT state,
float x_0,
float * BW_RESTRICT y_l_0,
float * BW_RESTRICT y_r_0);
Resets the given state
to its initial values using the given coeffs
and the initial input value x_0
.
The corresponding initial output values are put into y_l_0
(left) and y_r_0
(right).
static inline void bwp_hera_chorus_reset_state_multi(
const bwp_hera_chorus_coeffs * BW_RESTRICT coeffs,
bwp_hera_chorus_state * BW_RESTRICT const * BW_RESTRICT state,
const float * x_0,
float * y_l_0,
float * y_r_0,
size_t n_channels);
Resets each of the n_channels
state
s to its initial values using the given coeffs
and the corresponding initial input value in the x_0
array.
The corresponding initial output values are written into the y_l_0
(left) and y_r_0
arrays, if each is not BW_NULL
.
static inline void bwp_hera_chorus_update_coeffs_ctrl(
bwp_hera_chorus_coeffs * BW_RESTRICT coeffs);
Triggers control-rate update of coefficients in coeffs
.
static inline void bwp_hera_chorus_update_coeffs_audio(
bwp_hera_chorus_coeffs * BW_RESTRICT coeffs);
Triggers audio-rate update of coefficients in coeffs
.
static inline void bwp_hera_chorus_process1(
const bwp_hera_chorus_coeffs * BW_RESTRICT coeffs,
bwp_hera_chorus_state * BW_RESTRICT state,
float x,
float * BW_RESTRICT y_l,
float * BW_RESTRICT y_r);
Processes one input sample x
using coeffs
, while using and updating state
. The left and right output samples are put into y_l
(left) and y_r
(right) respectively.
static inline void bwp_hera_chorus_process(
bwp_hera_chorus_coeffs * BW_RESTRICT coeffs,
bwp_hera_chorus_state * BW_RESTRICT state,
const float * x,
float * y_l,
float * y_r,
size_t n_samples);
Processes the first n_samples
of the input buffer x
and fills the first n_samples
of the output buffers y_l
(left) and y_r
(right), while using and updating both coeffs
and state
(control and audio rate).
static inline void bwp_hera_chorus_process_multi(
bwp_hera_chorus_coeffs * BW_RESTRICT coeffs,
bwp_hera_chorus_state * BW_RESTRICT const * BW_RESTRICT state,
const float * const * x,
float * const * y_l,
float * const * y_r,
size_t n_channels,
size_t n_samples);
Processes the first n_samples
of the n_channels
input buffers x
and fills the first n_samples
of the n_channels
output buffers y_l
(left) and y_r
(right), while using and updating both the common coeffs
and each of the n_channels
state
s (control and audio rate).
static inline void bwp_hera_chorus_set_I(
bwp_hera_chorus_coeffs * BW_RESTRICT coeffs,
char value);
Sets the value
of the I switch in coeffs
(0
off, non-0
on).
This parameter is not smoothed.
Default value: 0
(off).
static inline void bwp_hera_chorus_set_II(
bwp_hera_chorus_coeffs * BW_RESTRICT coeffs,
char value);
Sets the value
of the II switch in coeffs
(0
off, non-0
on).
This parameter is not smoothed.
Default value: 0
(off).
static inline void bwp_hera_chorus_set_bias(
bwp_hera_chorus_coeffs * BW_RESTRICT coeffs,
float value);
Sets the BBD input bias to the given (relative) value
in coeffs
.
This parameter is not smoothed.
Valid range: [0.f
, 1.f
].
Default value: 0.5f
.
static inline void bwp_hera_chorus_set_bbd_snr_lin(
bwp_hera_chorus_coeffs * BW_RESTRICT coeffs,
float value);
Sets the BBD noise level so that the maximum SNR corresponds to value
(linear gain) in coeffs
.
This parameter is not smoothed.
value
must be finite.
Default value: 3.9810717055349634e-5f
.
static inline void bwp_hera_chorus_set_bbd_snr_dB(
bwp_hera_chorus_coeffs * BW_RESTRICT coeffs,
float value);
Sets the BBD noise level so that the maximum SNR corresponds to value
(dB) in coeffs
.
This parameter is not smoothed.
value
must be less than or equal to 770.630f
.
Default value: -88.f
.
static inline void bwp_hera_chorus_set_wet(
bwp_hera_chorus_coeffs * BW_RESTRICT coeffs,
float value);
Sets the wet signal gain parameter to the given value
(linear gain) in coeffs
.
value
must be finite.
Default value: 1.2051282051282048f
.
static inline void bwp_hera_chorus_set_rate_I(
bwp_hera_chorus_coeffs * BW_RESTRICT coeffs,
float value);
Sets the modulation rate value
(Hz) used when I is on and II is off in coeffs
.
Valid range: [0.f
, 100.f
].
Default value: 0.48836273122327095f
.
static inline void bwp_hera_chorus_set_rate_II(
bwp_hera_chorus_coeffs * BW_RESTRICT coeffs,
float value);
Sets the modulation rate value
(Hz) used when I is off and II is on in coeffs
.
Valid range: [0.f
, 100.f
].
Default value: 0.8205271608028923f
.
static inline void bwp_hera_chorus_set_rate_I_II(
bwp_hera_chorus_coeffs * BW_RESTRICT coeffs,
float value);
Sets the modulation rate value
(Hz) used when both I and II are on in coeffs
.
Valid range: [0.f
, 100.f
].
Default value: 9.622027515149883f
.
static inline void bwp_hera_chorus_set_phase_diff(
bwp_hera_chorus_coeffs * BW_RESTRICT coeffs,
float value);
Sets the phase difference value
(normalized range) between left and right modulation when either I or II is on in coeffs
.
Valid range: [0.f
, 1.f
).
Default value: 0.5f
.
static inline void bwp_hera_chorus_set_buggy_dist(
bwp_hera_chorus_coeffs * BW_RESTRICT coeffs,
char value);
Sets whether to use the buggy distortion algorithm from version 1.0.0 (value
non-0
) or not (0
) in coeffs
.
Default value: 0
(do not use buggy distortion).
static inline char bwp_hera_chorus_coeffs_is_valid(
const bwp_hera_chorus_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_hera_chorus_coeffs
.
static inline char bwp_hera_chorus_state_is_valid(
const bwp_hera_chorus_coeffs * BW_RESTRICT coeffs,
const bwp_hera_chorus_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_hera_chorus_state
.
template<size_t N_CHANNELS>
class HeraChorus {
public:
HeraChorus();
void setSampleRate(
float sampleRate);
void reset(
float x0 = 0.f,
float * BW_RESTRICT yL0 = nullptr,
float * BW_RESTRICT yR0 = nullptr);
# ifndef BW_CXX_NO_ARRAY
void reset(
float x0,
std::array<float, N_CHANNELS> * BW_RESTRICT yL0,
std::array<float, N_CHANNELS> * BW_RESTRICT yR0);
# endif
void reset(
const float * x0,
float * yL0 = nullptr,
float * yR0 = nullptr);
# ifndef BW_CXX_NO_ARRAY
void reset(
std::array<float, N_CHANNELS> x0,
std::array<float, N_CHANNELS> * BW_RESTRICT yL0 = nullptr,
std::array<float, N_CHANNELS> * BW_RESTRICT yR0 = nullptr);
# endif
void process(
const float * const * x,
float * const * yL,
float * const * yR,
size_t nSamples);
# ifndef BW_CXX_NO_ARRAY
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> yL,
std::array<float *, N_CHANNELS> yR,
size_t nSamples);
# endif
void setI(
bool value);
void setII(
bool value);
void setBias(
float value);
void setBbdSnrLin(
float value);
void setBbdSnrDB(
float value);
void setWet(
float value);
void setRateI(
float value);
void setRateII(
float value);
void setRateI_II(
float value);
void setPhaseDiff(
float value);
void setBuggyDist(
char value);
...
}