From fe67302b62cb5d9353ce823e3133d93ba768ef8d Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Fri, 31 May 2019 16:58:13 +0200 Subject: [PATCH] Small fixes. --- MicroMDAEPiano.ino | 4 +++- effect_modulated_chorus.cpp | 7 +++---- 2 files changed, 6 insertions(+), 5 deletions(-) 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++;