From 29d8634a1e15e31224583b069132cb11c430ec68 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Sat, 25 Dec 2021 20:02:07 +0100 Subject: [PATCH] EP stereo chorus fixes. --- MicroDexed.ino | 15 ++++++++------- UI.hpp | 2 +- dexed_sd.cpp | 2 +- effect_modulated_delay.cpp | 29 ++++++++--------------------- effect_modulated_delay.h | 2 +- 5 files changed, 19 insertions(+), 31 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index c0ebd64..0706636 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -264,8 +264,8 @@ AudioConnection patchCord[] = { {ep_modchorus, 1, ep_chorus_mixer_l, 1}, {ep_chorus_mixer_r, 0, reverb_mixer_r, REVERB_MIX_CH_EPIANO}, {ep_chorus_mixer_l, 0, reverb_mixer_l, REVERB_MIX_CH_EPIANO}, - {ep_stereo_panorama, 0, master_mixer_r, MASTER_MIX_CH_EPIANO}, - {ep_stereo_panorama, 1, master_mixer_l, MASTER_MIX_CH_EPIANO}, + {ep_modchorus, 0, master_mixer_r, MASTER_MIX_CH_EPIANO}, + {ep_modchorus, 1, master_mixer_l, MASTER_MIX_CH_EPIANO}, #else {ep_stereo_panorama, 0, master_mixer_r, MASTER_MIX_CH_EPIANO}, {ep_stereo_panorama, 1, master_mixer_l, MASTER_MIX_CH_EPIANO}, @@ -776,7 +776,7 @@ void setup() Serial.println(F("")); #endif - ep_modchorus.set_bypass(true); + //ep_modchorus.set_bypass(true); strcpy(seq.seq_name, "INIT Perf"); LCDML.OTHER_jumpToFunc(UI_func_voice_select); @@ -2215,10 +2215,10 @@ void check_configuration_fx(void) #if defined(USE_EPIANO) configuration.fx.ep_chorus_frequency = constrain(configuration.fx.ep_chorus_frequency, EP_CHORUS_FREQUENCY_MIN, EP_CHORUS_FREQUENCY_MAX); - configuration.fx.ep_chorus_waveform = constrain(configuration.fx.ep_chorus_waveform, EP_CHORUS_WAVEFORM_MIN, EP_CHORUS_FREQUENCY_MAX); - configuration.fx.ep_chorus_depth = constrain(configuration.fx.ep_chorus_depth, EP_CHORUS_DEPTH_MIN, EP_CHORUS_FREQUENCY_MAX); - configuration.fx.ep_chorus_level = constrain(configuration.fx.ep_chorus_level, EP_CHORUS_LEVEL_MIN, EP_CHORUS_FREQUENCY_MAX); - configuration.fx.ep_reverb_send = constrain(configuration.fx.ep_reverb_send, EP_REVERB_SEND_MIN, EP_CHORUS_FREQUENCY_MAX); + configuration.fx.ep_chorus_waveform = constrain(configuration.fx.ep_chorus_waveform, EP_CHORUS_WAVEFORM_MIN, EP_CHORUS_WAVEFORM_MAX); + configuration.fx.ep_chorus_depth = constrain(configuration.fx.ep_chorus_depth, EP_CHORUS_DEPTH_MIN, EP_CHORUS_DEPTH_MAX); + configuration.fx.ep_chorus_level = constrain(configuration.fx.ep_chorus_level, EP_CHORUS_LEVEL_MIN, EP_CHORUS_LEVEL_MAX); + configuration.fx.ep_reverb_send = constrain(configuration.fx.ep_reverb_send, EP_REVERB_SEND_MIN, EP_REVERB_SEND_MAX); #endif } @@ -3267,6 +3267,7 @@ void show_patch(uint8_t instance_id) void SerialPrintFormatInt3(uint8_t num) { char buf[4]; + memset(buf, 0, 4); sprintf(buf, "%3d", num); Serial.print(buf); } diff --git a/UI.hpp b/UI.hpp index d444671..9d07c7d 100644 --- a/UI.hpp +++ b/UI.hpp @@ -3154,7 +3154,7 @@ void UI_func_epiano_chorus_depth(uint8_t param) lcd_display_bar_int("EP Ch. Depth", configuration.fx.ep_chorus_depth, 1.0, EP_CHORUS_DEPTH_MIN, EP_CHORUS_DEPTH_MAX, 3, false, false, false); #if defined(USE_EPIANO) - ep_chorus_modulator.amplitude(configuration.fx.ep_chorus_depth / 100.0); + ep_chorus_modulator.amplitude(mapfloat(configuration.fx.ep_chorus_depth, EP_CHORUS_DEPTH_MIN, EP_CHORUS_DEPTH_MAX, 0.0, 1.0)); #endif } diff --git a/dexed_sd.cpp b/dexed_sd.cpp index daa21da..cce3dd2 100644 --- a/dexed_sd.cpp +++ b/dexed_sd.cpp @@ -929,7 +929,7 @@ bool save_sd_fx_json(uint8_t number) data_json["eq_7"] = configuration.fx.eq_7; data_json["ep_chorus_frequency"] = configuration.fx.ep_chorus_frequency; data_json["ep_chorus_waveform"] = configuration.fx.ep_chorus_waveform; - data_json["ep_chorus_dept"] = configuration.fx.ep_chorus_depth; + data_json["ep_chorus_depth"] = configuration.fx.ep_chorus_depth; data_json["ep_chorus_level"] = configuration.fx.ep_chorus_level; data_json["ep_reverb_send"] = configuration.fx.ep_reverb_send; diff --git a/effect_modulated_delay.cpp b/effect_modulated_delay.cpp index 909afb3..54326cf 100644 --- a/effect_modulated_delay.cpp +++ b/effect_modulated_delay.cpp @@ -72,10 +72,7 @@ boolean AudioEffectModulatedDelay::begin(short *delayline, uint16_t d_length) Serial.println(F(")")); #endif - _delayline = NULL; - _delay_length = 0; _cb_index = 0; - _delay_offset = 0; if (delayline == NULL) return (false); @@ -196,15 +193,8 @@ boolean AudioEffectModulatedDelayStereo::begin(short *delayline_l, short *delayl Serial.println(F(")")); #endif - _delay_length = 0; - - _delayline[0] = NULL; _cb_index[0] = 0; - _delay_offset[0] = 0; - - _delayline[1] = NULL; _cb_index[1] = 0; - _delay_offset[1] = 0; if (delayline_r == NULL) return (false); @@ -214,14 +204,13 @@ boolean AudioEffectModulatedDelayStereo::begin(short *delayline_l, short *delayl return (false); _delay_length = d_length; + _delay_offset = _delay_length >> 1; _delayline[0] = delayline_l; memset(_delayline[0], 0, _delay_length * sizeof(int16_t)); - _delay_offset[0] = _delay_length >> 1 ; _delayline[1] = delayline_r; memset(_delayline[1], 0, _delay_length * sizeof(int16_t)); - _delay_offset[1] = _delay_length >> 1 ; stereo = true; @@ -266,7 +255,7 @@ void AudioEffectModulatedDelayStereo::update(void) if (block[1] != (audio_block_t*)&zeroblock) { - transmit(block[1], 0); + transmit(block[1], 1); release(block[1]); } return; @@ -292,7 +281,7 @@ void AudioEffectModulatedDelayStereo::update(void) { // LEFT // calculate the modulation-index as a floating point number for interpolation - mod_index = *mp * _delay_offset[0]; + mod_index = *mp * _delay_offset; mod_fraction = modff(mod_index, &mod_number); // split float of mod_index into integer (= mod_number) and fraction part // write data into circular buffer (delayline) @@ -301,7 +290,7 @@ void AudioEffectModulatedDelayStereo::update(void) _delayline[0][_cb_index[0]] = *bp[0]; // calculate modulation index into circular buffer - cb_mod_index[0] = _cb_index[0] - (_delay_offset[0] + mod_number); + cb_mod_index[0] = _cb_index[0] - (_delay_offset + mod_number); if (cb_mod_index[0] < 0) // check for negative offsets and correct them cb_mod_index[0] += _delay_length; @@ -318,10 +307,8 @@ void AudioEffectModulatedDelayStereo::update(void) // RIGHT // calculate the modulation-index as a floating point number for interpolation - if (stereo == true) - mod_index = -1.0 * *mp * _delay_offset[0]; - else - mod_index = *mp * _delay_offset[0]; + //if (stereo == true) + // mod_index *= -1.0; mod_fraction = modff(mod_index, &mod_number); // split float of mod_index into integer (= mod_number) and fraction part @@ -331,7 +318,7 @@ void AudioEffectModulatedDelayStereo::update(void) _delayline[1][_cb_index[1]] = *bp[1]; // calculate modulation index into circular buffer - cb_mod_index[1] = _cb_index[1] - (_delay_offset[1] + mod_number); + cb_mod_index[1] = _cb_index[1] - (_delay_offset + mod_number); if (cb_mod_index[1] < 0) // check for negative offsets and correct them cb_mod_index[1] += _delay_length; @@ -360,7 +347,7 @@ void AudioEffectModulatedDelayStereo::update(void) } if (block[1] != (audio_block_t*)&zeroblock) { - transmit(block[1], 0); + transmit(block[1], 1); release(block[1]); } } diff --git a/effect_modulated_delay.h b/effect_modulated_delay.h index 9710dd9..7fa0630 100644 --- a/effect_modulated_delay.h +++ b/effect_modulated_delay.h @@ -80,7 +80,7 @@ class AudioEffectModulatedDelayStereo : uint16_t _cb_index[2]; // current write pointer of the circular buffer uint16_t _delay_length; // calculated number of samples of the delay int16_t cb_mod_index[2]; // current read pointer with modulation for the circular buffer - uint16_t _delay_offset[2]; + uint16_t _delay_offset; bool stereo; bool bypass; };