diff --git a/MicroMDAEPiano.ino b/MicroMDAEPiano.ino index 23c9be8..992b253 100644 --- a/MicroMDAEPiano.ino +++ b/MicroMDAEPiano.ino @@ -239,8 +239,10 @@ void setup() } // chorus modulation fixed + memset(r_delayline,0,sizeof(short)*CHORUS_DELAY_LENGTH); + memset(l_delayline,0,sizeof(short)*CHORUS_DELAY_LENGTH); mod_sine1.amplitude(1.0); - mod_sine1.frequency(5.0); + mod_sine1.frequency(2.0); mod_sine1.phase(0); // chorus level fixed mixer_r.gain(2, 1.0); diff --git a/effect_modulated_chorus.cpp b/effect_modulated_chorus.cpp index c5d8e9e..bf25d5e 100644 --- a/effect_modulated_chorus.cpp +++ b/effect_modulated_chorus.cpp @@ -132,18 +132,17 @@ void AudioModulatedEffectChorus::update(void) // linear interpolation x1 = int(mod_idx); y1 = *(block->data + x1); - if (x1 + 1 > delay_length) + if (x1 + 1 >= delay_length) { x2 = 0; - y2 = *block->data; + y2 = *bp; } else { x2 = x1 + 1; - y2 = *(block->data + x2); + y2 = *bp + x2; } *bp = (*bp >> 1) + (int((float(y2 - y1) / (x2 - x1) * (mod_idx - x1) + y1) + 0.5) >> 1); // mix original signal 1:1 with modulated signal - bp++; mp++; l_circ_idx++;