Holger Wirtz 5 years ago
parent 444d823cd1
commit f8d7c097ac
  1. 8
      effect_modulated_delay.cpp

@ -65,6 +65,8 @@ void AudioEffectModulatedDelay::update(void)
{
audio_block_t *block;
audio_block_t *modulation;
float alpha = 0.9f; // 90% new value, 10% feedback
static float filteredOutput;
if (_delayline == NULL)
return;
@ -92,8 +94,12 @@ void AudioEffectModulatedDelay::update(void)
_cb_index = 0;
_delayline[_cb_index] = *bp;
// Simple 1st order IIR, mix the new value with the old value (for modulation to get a band-limited signal)
filteredOutput = (*mp * alpha) + filteredOutput * (1 - alpha);
// Calculate the modulation-index as a floating point number for interpolation
mod_index = *mp * (1 - MODULATION_MAX_FACTOR) * _delay_length; // "(1 - MODULATION_MAX_FACTOR) * _delay_length" means: maximum bytes of modulation allowed by given delay length
//mod_index = *mp * (1 - MODULATION_MAX_FACTOR) * _delay_length; // "(1 - MODULATION_MAX_FACTOR) * _delay_length" means: maximum bytes of modulation allowed by given delay length
mod_index = filteredOutput * (1 - MODULATION_MAX_FACTOR) * _delay_length; // "(1 - MODULATION_MAX_FACTOR) * _delay_length" means: maximum bytes of modulation allowed by given delay length
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

Loading…
Cancel
Save