Chorus works :-) but linear interpolation is not the best... will try

splines...
master
Holger Wirtz 6 years ago
parent 7cc48260c8
commit 02a60d10b1
  1. 17
      MicroMDAEPiano.ino
  2. 12
      effect_modulated_chorus.cpp

@ -56,15 +56,15 @@ AudioAmplifier volume_r;
AudioAmplifier volume_l;
AudioModulatedEffectChorus modchorus_r;
AudioModulatedEffectChorus modchorus_l;
AudioSynthWaveformSine mod_sine1;
AudioSynthWaveform modulator;
AudioConnection patchCord0(queue_r, peak_r);
AudioConnection patchCord1(queue_l, peak_l);
AudioConnection patchCord2(queue_r, freeverb_r);
AudioConnection patchCord3(queue_l, freeverb_l);
AudioConnection patchCord4(queue_r, 0, modchorus_r, 0);
AudioConnection patchCord5(queue_l, 0, modchorus_l, 0);
AudioConnection patchCord6(mod_sine1, 0, modchorus_r, 1);
AudioConnection patchCord7(mod_sine1, 0, modchorus_l, 1);
AudioConnection patchCord6(modulator, 0, modchorus_r, 1);
AudioConnection patchCord7(modulator, 0, modchorus_l, 1);
AudioConnection patchCord8(queue_r, 0, mixer_r, 0);
AudioConnection patchCord9(queue_l, 0, mixer_l, 0);
AudioConnection patchCord10(modchorus_r, 0, mixer_r, 2);
@ -241,12 +241,13 @@ 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(2.0);
mod_sine1.phase(0);
modulator.begin(WAVEFORM_TRIANGLE);
modulator.amplitude(0.1);
modulator.frequency(1.0);
modulator.phase(0);
// chorus level fixed
mixer_r.gain(2, 1.0);
mixer_l.gain(2, 1.0);
mixer_r.gain(2, 0.5);
mixer_l.gain(2, 0.5);
AudioInterrupts();

@ -131,18 +131,14 @@ void AudioModulatedEffectChorus::update(void)
// linear interpolation
x1 = int(mod_idx);
y1 = *(block->data + x1);
y1 = l_delayline[x1];
if (x1 + 1 >= delay_length)
{
x2 = 0;
y2 = *bp;
}
else
{
x2 = x1 + 1;
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
y2 = l_delayline[x2];
*bp = (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++;

Loading…
Cancel
Save