EP stereo chorus fixes.

pull/112/head
Holger Wirtz 3 years ago
parent a38f64bd39
commit 29d8634a1e
  1. 15
      MicroDexed.ino
  2. 2
      UI.hpp
  3. 2
      dexed_sd.cpp
  4. 29
      effect_modulated_delay.cpp
  5. 2
      effect_modulated_delay.h

@ -264,8 +264,8 @@ AudioConnection patchCord[] = {
{ep_modchorus, 1, ep_chorus_mixer_l, 1}, {ep_modchorus, 1, ep_chorus_mixer_l, 1},
{ep_chorus_mixer_r, 0, reverb_mixer_r, REVERB_MIX_CH_EPIANO}, {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_chorus_mixer_l, 0, reverb_mixer_l, REVERB_MIX_CH_EPIANO},
{ep_stereo_panorama, 0, master_mixer_r, MASTER_MIX_CH_EPIANO}, {ep_modchorus, 0, master_mixer_r, MASTER_MIX_CH_EPIANO},
{ep_stereo_panorama, 1, master_mixer_l, MASTER_MIX_CH_EPIANO}, {ep_modchorus, 1, master_mixer_l, MASTER_MIX_CH_EPIANO},
#else #else
{ep_stereo_panorama, 0, master_mixer_r, MASTER_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_stereo_panorama, 1, master_mixer_l, MASTER_MIX_CH_EPIANO},
@ -776,7 +776,7 @@ void setup()
Serial.println(F("<setup end>")); Serial.println(F("<setup end>"));
#endif #endif
ep_modchorus.set_bypass(true); //ep_modchorus.set_bypass(true);
strcpy(seq.seq_name, "INIT Perf"); strcpy(seq.seq_name, "INIT Perf");
LCDML.OTHER_jumpToFunc(UI_func_voice_select); LCDML.OTHER_jumpToFunc(UI_func_voice_select);
@ -2215,10 +2215,10 @@ void check_configuration_fx(void)
#if defined(USE_EPIANO) #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_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_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_FREQUENCY_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_FREQUENCY_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_CHORUS_FREQUENCY_MAX); configuration.fx.ep_reverb_send = constrain(configuration.fx.ep_reverb_send, EP_REVERB_SEND_MIN, EP_REVERB_SEND_MAX);
#endif #endif
} }
@ -3267,6 +3267,7 @@ void show_patch(uint8_t instance_id)
void SerialPrintFormatInt3(uint8_t num) void SerialPrintFormatInt3(uint8_t num)
{ {
char buf[4]; char buf[4];
memset(buf, 0, 4);
sprintf(buf, "%3d", num); sprintf(buf, "%3d", num);
Serial.print(buf); Serial.print(buf);
} }

@ -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); 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) #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 #endif
} }

@ -929,7 +929,7 @@ bool save_sd_fx_json(uint8_t number)
data_json["eq_7"] = configuration.fx.eq_7; data_json["eq_7"] = configuration.fx.eq_7;
data_json["ep_chorus_frequency"] = configuration.fx.ep_chorus_frequency; data_json["ep_chorus_frequency"] = configuration.fx.ep_chorus_frequency;
data_json["ep_chorus_waveform"] = configuration.fx.ep_chorus_waveform; 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_chorus_level"] = configuration.fx.ep_chorus_level;
data_json["ep_reverb_send"] = configuration.fx.ep_reverb_send; data_json["ep_reverb_send"] = configuration.fx.ep_reverb_send;

@ -72,10 +72,7 @@ boolean AudioEffectModulatedDelay::begin(short *delayline, uint16_t d_length)
Serial.println(F(")")); Serial.println(F(")"));
#endif #endif
_delayline = NULL;
_delay_length = 0;
_cb_index = 0; _cb_index = 0;
_delay_offset = 0;
if (delayline == NULL) if (delayline == NULL)
return (false); return (false);
@ -196,15 +193,8 @@ boolean AudioEffectModulatedDelayStereo::begin(short *delayline_l, short *delayl
Serial.println(F(")")); Serial.println(F(")"));
#endif #endif
_delay_length = 0;
_delayline[0] = NULL;
_cb_index[0] = 0; _cb_index[0] = 0;
_delay_offset[0] = 0;
_delayline[1] = NULL;
_cb_index[1] = 0; _cb_index[1] = 0;
_delay_offset[1] = 0;
if (delayline_r == NULL) if (delayline_r == NULL)
return (false); return (false);
@ -214,14 +204,13 @@ boolean AudioEffectModulatedDelayStereo::begin(short *delayline_l, short *delayl
return (false); return (false);
_delay_length = d_length; _delay_length = d_length;
_delay_offset = _delay_length >> 1;
_delayline[0] = delayline_l; _delayline[0] = delayline_l;
memset(_delayline[0], 0, _delay_length * sizeof(int16_t)); memset(_delayline[0], 0, _delay_length * sizeof(int16_t));
_delay_offset[0] = _delay_length >> 1 ;
_delayline[1] = delayline_r; _delayline[1] = delayline_r;
memset(_delayline[1], 0, _delay_length * sizeof(int16_t)); memset(_delayline[1], 0, _delay_length * sizeof(int16_t));
_delay_offset[1] = _delay_length >> 1 ;
stereo = true; stereo = true;
@ -266,7 +255,7 @@ void AudioEffectModulatedDelayStereo::update(void)
if (block[1] != (audio_block_t*)&zeroblock) if (block[1] != (audio_block_t*)&zeroblock)
{ {
transmit(block[1], 0); transmit(block[1], 1);
release(block[1]); release(block[1]);
} }
return; return;
@ -292,7 +281,7 @@ void AudioEffectModulatedDelayStereo::update(void)
{ {
// LEFT // LEFT
// calculate the modulation-index as a floating point number for interpolation // 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 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) // write data into circular buffer (delayline)
@ -301,7 +290,7 @@ void AudioEffectModulatedDelayStereo::update(void)
_delayline[0][_cb_index[0]] = *bp[0]; _delayline[0][_cb_index[0]] = *bp[0];
// calculate modulation index into circular buffer // 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 if (cb_mod_index[0] < 0) // check for negative offsets and correct them
cb_mod_index[0] += _delay_length; cb_mod_index[0] += _delay_length;
@ -318,10 +307,8 @@ void AudioEffectModulatedDelayStereo::update(void)
// RIGHT // RIGHT
// calculate the modulation-index as a floating point number for interpolation // calculate the modulation-index as a floating point number for interpolation
if (stereo == true) //if (stereo == true)
mod_index = -1.0 * *mp * _delay_offset[0]; // mod_index *= -1.0;
else
mod_index = *mp * _delay_offset[0];
mod_fraction = modff(mod_index, &mod_number); // split float of mod_index into integer (= mod_number) and fraction part 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]; _delayline[1][_cb_index[1]] = *bp[1];
// calculate modulation index into circular buffer // 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 if (cb_mod_index[1] < 0) // check for negative offsets and correct them
cb_mod_index[1] += _delay_length; cb_mod_index[1] += _delay_length;
@ -360,7 +347,7 @@ void AudioEffectModulatedDelayStereo::update(void)
} }
if (block[1] != (audio_block_t*)&zeroblock) if (block[1] != (audio_block_t*)&zeroblock)
{ {
transmit(block[1], 0); transmit(block[1], 1);
release(block[1]); release(block[1]);
} }
} }

@ -80,7 +80,7 @@ class AudioEffectModulatedDelayStereo :
uint16_t _cb_index[2]; // current write pointer of the circular buffer uint16_t _cb_index[2]; // current write pointer of the circular buffer
uint16_t _delay_length; // calculated number of samples of the delay 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 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 stereo;
bool bypass; bool bypass;
}; };

Loading…
Cancel
Save