Fix for modulated delay.

dev
Holger Wirtz 5 years ago
parent efe85ad8d9
commit 4a8d875515
  1. 7
      MicroMDAEPiano.ino
  2. 4
      config.h
  3. 12
      effect_modulated_delay.cpp

@ -239,11 +239,16 @@ void setup()
Serial.println(F("AudioEffectModulatedDelay - left channel begin failed")); Serial.println(F("AudioEffectModulatedDelay - left channel begin failed"));
while (1); while (1);
} }
#ifdef DEBUG
Serial.print(F("MOD_DELAY_SAMPLE_BUFFER="));
Serial.print(MOD_DELAY_SAMPLE_BUFFER, DEC);
Serial.println(F(" samples"));
#endif
// chorus modulation fixed // chorus modulation fixed
modulator.begin(MOD_WAVEFORM); modulator.begin(MOD_WAVEFORM);
modulator.phase(0); modulator.phase(0);
modulator.amplitude(0.0); modulator.amplitude(0.5);
modulator.offset(0.0); modulator.offset(0.0);
#if MOD_FILTER_OUTPUT == MOD_BUTTERWORTH_FILTER_OUTPUT #if MOD_FILTER_OUTPUT == MOD_BUTTERWORTH_FILTER_OUTPUT
// Butterworth filter, 12 db/octave // Butterworth filter, 12 db/octave

@ -76,7 +76,7 @@
#define SERIAL_SPEED 38400 #define SERIAL_SPEED 38400
#define SHOW_XRUN 1 #define SHOW_XRUN 1
#define SHOW_CPU_LOAD_MSEC 5000 #define SHOW_CPU_LOAD_MSEC 5000
//#define DEBUG_AUDIO 50 #define DEBUG_AUDIO 50
//************************************************************************************************* //*************************************************************************************************
//* HARDWARE SETTINGS //* HARDWARE SETTINGS
@ -275,7 +275,7 @@
#define ENC_REVERB_DAMPING_MAX 99 #define ENC_REVERB_DAMPING_MAX 99
#define ENC_REVERB_DAMPING_DEFAULT 50 #define ENC_REVERB_DAMPING_DEFAULT 50
// //
#define ENC_REVERB_LEVEL_MIN 0 #define ENC_REVERB_LEVEL_MIN 1
#define ENC_REVERB_LEVEL_MAX 99 #define ENC_REVERB_LEVEL_MAX 99
#define ENC_REVERB_LEVEL_DEFAULT 15 #define ENC_REVERB_LEVEL_DEFAULT 15
// //

@ -50,17 +50,15 @@ boolean AudioEffectModulatedDelay::begin(short *delayline, uint16_t d_length)
_cb_index = 0; _cb_index = 0;
_delay_offset = 0; _delay_offset = 0;
if (delayline == NULL) { if (delayline == NULL)
return (false); return (false);
} if (d_length < 10)
if (d_length < 10) {
return (false); return (false);
}
_delayline = delayline; _delayline = delayline;
_delay_length = d_length; _delay_length = d_length;
memset(_delayline, 0, _delay_length); memset(_delayline, 0, _delay_length * sizeof(int16_t));
_delay_offset = (_delay_length - 1) >> 1; _delay_offset = _delay_length >> 1 ;
return (true); return (true);
} }
@ -107,7 +105,7 @@ void AudioEffectModulatedDelay::update(void)
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
// calculate modulation index into circular buffer // calculate modulation index into circular buffer
cb_mod_index = _cb_index - mod_number; cb_mod_index = _cb_index - (_delay_offset + mod_number);
if (cb_mod_index < 0) // check for negative offsets and correct them if (cb_mod_index < 0) // check for negative offsets and correct them
cb_mod_index += _delay_length; cb_mod_index += _delay_length;

Loading…
Cancel
Save