|
|
|
@ -59,20 +59,15 @@ boolean AudioEffectModulatedDelay::begin(short *delayline, int d_length) |
|
|
|
|
_delay_length = d_length; |
|
|
|
|
|
|
|
|
|
#ifdef CHORUS_MODULATOR_BIQUAD |
|
|
|
|
mod_lp_coeffs[0] = -1.98982427; // https://arachnoid.com/BiQuadDesigner/ Lopass Fc=50Hz, Q=0.7
|
|
|
|
|
mod_lp_coeffs[1] = 0.98987476; |
|
|
|
|
mod_lp_coeffs[2] = 1.26228228e-5; |
|
|
|
|
mod_lp_coeffs[3] = 2.52456456e-5; |
|
|
|
|
mod_lp_coeffs[4] = 1.26228228e-5; |
|
|
|
|
biquad_mod = {1, mod_lp_state, mod_lp_coeffs}; |
|
|
|
|
#endif |
|
|
|
|
#ifdef CHORUS_OUTUT_BIQUAD // https://web.fhnw.ch/technik/projekte/eit/Fruehling2016/MuelZum/html/parametric__equalizer__example_8c_source.html
|
|
|
|
|
out_lp_coeffs[0] = -0.10987036; // https://arachnoid.com/BiQuadDesigner/ Lopass Fc=10000Hz, Q=0.3
|
|
|
|
|
out_lp_coeffs[1] = -0.24497694; |
|
|
|
|
out_lp_coeffs[2] = 0.16128817; |
|
|
|
|
out_lp_coeffs[3] = 0.32257635; |
|
|
|
|
out_lp_coeffs[4] = 0.16128817; |
|
|
|
|
biquad_out = {1, out_lp_state, out_lp_coeffs, 0}; |
|
|
|
|
filter_lp_mod.numStages = 1; |
|
|
|
|
filter_lp_mod.pState = filter_lp_state; |
|
|
|
|
filter_lp_mod.pCoeffs = filter_lp_coeffs; |
|
|
|
|
|
|
|
|
|
filter_lp_coeffs[0] = 0.072959657268266670; |
|
|
|
|
filter_lp_coeffs[1] = 0.072959657268266670; |
|
|
|
|
filter_lp_coeffs[2] = 0.0; |
|
|
|
|
filter_lp_coeffs[3] = 0.854080685463466605; |
|
|
|
|
filter_lp_coeffs[4] = 0.0; |
|
|
|
|
#endif |
|
|
|
|
return (true); |
|
|
|
|
} |
|
|
|
@ -95,13 +90,12 @@ void AudioEffectModulatedDelay::update(void) |
|
|
|
|
float mod_idx; |
|
|
|
|
float mod_number; |
|
|
|
|
float mod_fraction; |
|
|
|
|
float mod_float[AUDIO_BLOCK_SAMPLES]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bp = block->data; |
|
|
|
|
arm_q15_to_float(modulation->data, mod_float, AUDIO_BLOCK_SAMPLES); |
|
|
|
|
mp = mod_float; |
|
|
|
|
arm_q15_to_float(modulation->data, modulation_f32, AUDIO_BLOCK_SAMPLES); |
|
|
|
|
mp = modulation_f32; |
|
|
|
|
#ifdef CHORUS_MODULATOR_BIQUAD |
|
|
|
|
arm_biquad_cascade_df1_f32(&biquad_mod, mod_float, mod_float, AUDIO_BLOCK_SAMPLES); |
|
|
|
|
arm_biquad_cascade_df1_f32(&filter_lp_mod, modulation_f32, modulation_f32, AUDIO_BLOCK_SAMPLES); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
for (uint16_t i = 0; i < AUDIO_BLOCK_SAMPLES; i++) |
|
|
|
@ -133,14 +127,13 @@ void AudioEffectModulatedDelay::update(void) |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
idx[0] = c_mod_idx + 1; |
|
|
|
|
idx[1] = c_mod_idx; |
|
|
|
|
idx[0] = c_mod_idx; |
|
|
|
|
idx[1] = c_mod_idx + 1; |
|
|
|
|
} |
|
|
|
|
if (mod_idx < 0.0) |
|
|
|
|
*bp = round(float(_delayline[idx[0]]) * (mod_fraction) + float(_delayline[idx[1]]) * (1.0 - mod_fraction)); |
|
|
|
|
else |
|
|
|
|
*bp = round(float(_delayline[idx[0]]) * (1.0 - mod_fraction) + float(_delayline[idx[1]]) * mod_fraction); |
|
|
|
|
|
|
|
|
|
else |
|
|
|
|
*bp = round(float(_delayline[idx[0]]) * mod_fraction + float(_delayline[idx[1]]) * (1.0 - mod_fraction)); |
|
|
|
|
|
|
|
|
|
// push the pointers forward
|
|
|
|
|
bp++; // next audio data
|
|
|
|
@ -154,9 +147,6 @@ void AudioEffectModulatedDelay::update(void) |
|
|
|
|
|
|
|
|
|
if (block) |
|
|
|
|
{ |
|
|
|
|
#ifdef CHORUS_OUTPUT_BIQUAD |
|
|
|
|
arm_biquad_cascade_df1_fast_q15(&biquad_out, (q15_t*)block, (q15_t*)block, AUDIO_BLOCK_SAMPLES); |
|
|
|
|
#endif |
|
|
|
|
transmit(block, 0); |
|
|
|
|
release(block); |
|
|
|
|
} |
|
|
|
|