Removed chorus_intensity because modulator.amplitude can be used.

master
Holger Wirtz 5 years ago
parent 3f5f754460
commit 1356774e8e
  1. 3
      MicroMDAEPiano.ino
  2. 3
      UI.hpp
  3. 2
      config.h
  4. 15
      effect_modulated_delay.cpp
  5. 2
      effect_modulated_delay.h

@ -233,13 +233,12 @@ void setup()
// chorus modulation fixed
modulator.begin(CHORUS_WAVEFORM);
modulator.phase(0);
modulator.amplitude(1.0);
modulator.offset(0.0);
modulator_filter.setLowpass(0, CHORUS_MODULATOR_FILTER_FRQ, CHORUS_MODULATOR_FILTER_Q);
inverter.gain(-1.0); // change phase for second modulated delay (faked stereo mode)
modchorus_r.offset(15.0);
modchorus_r.intensity(1.0);
modchorus_l.offset(15.0);
modchorus_l.intensity(1.0);
// internal mixing of original signal(0), reverb(1) and chorus(2)
mixer_r.gain(VOL_MAIN, 0.5);

@ -2048,7 +2048,6 @@ void set_chorus_delay(uint8_t value)
Serial.println(value);
#endif
modchorus_r.offset(20.0);
modchorus_l.intensity(1.0);
configuration.chorus_delay = value;
}
@ -2058,7 +2057,7 @@ void set_chorus_intensity(uint8_t value)
Serial.print(F("Set CHORUS_INTENSITY "));
Serial.println(value);
#endif
modulator.amplitude(mapfloat(float(value), ENC_CHORUS_INTENSITY_MIN, ENC_CHORUS_INTENSITY_MAX, 0.0, 0.5));
modulator.amplitude(mapfloat(float(value), ENC_CHORUS_INTENSITY_MIN, ENC_CHORUS_INTENSITY_MAX, 0.0, 1.0));
configuration.chorus_intensity = value;
}

@ -57,7 +57,7 @@
// CHORUS parameters
#define CHORUS_DELAY_LENGTH_SAMPLES (15*AUDIO_BLOCK_SAMPLES) // one AUDIO_BLOCK_SAMPLES = 2.902ms
#define CHORUS_WAVEFORM WAVEFORM_TRIANGLE // WAVEFORM_SINE WAVEFORM_TRIANGLE WAVEFORM_SAWTOOTH WAVEFORM_SAWTOOTH_REVERSE
#define CHORUS_MODULATOR_FILTER_FRQ 50 // see https://www.earlevel.com/main/2013/10/13/biquad-calculator-v2/
#define CHORUS_MODULATOR_FILTER_FRQ 10 // see https://www.earlevel.com/main/2013/10/13/biquad-calculator-v2/
#define CHORUS_MODULATOR_FILTER_Q 0.7
//*************************************************************************************************

@ -46,7 +46,6 @@ boolean AudioEffectModulatedDelay::begin(short *delayline, int d_length)
_delayline = NULL;
_delay_length = 0;
_delay_offset = 0.0;
_modulation_intensity = 0.0;
_circ_idx = 0;
if (delayline == NULL) {
@ -73,7 +72,7 @@ void AudioEffectModulatedDelay::update(void)
block = receiveWritable(0);
modulation = receiveReadOnly(1);
if (block && modulation && _modulation_intensity > 0.1)
if (block && modulation)
{
int16_t *bp;
float *mp;
@ -94,7 +93,7 @@ void AudioEffectModulatedDelay::update(void)
_delayline[_circ_idx] = *bp;
// Calculate the modulation-index as a floating point number for interpolation
mod_idx = _delay_offset + (*mp * _modulation_intensity);
mod_idx = _delay_offset + (*mp * (1 - MODULATION_MAX_FACTOR) * _delay_length);
mod_fraction = modff(mod_idx, &mod_number);
// calculate modulation index into circular buffer
@ -149,13 +148,3 @@ float AudioEffectModulatedDelay::offset(float offset_value) // in ms
return (offset_frames / AUDIO_SAMPLE_RATE * 1000);
}
void AudioEffectModulatedDelay::intensity(float intensity_value)
{
if (intensity_value > 1.0)
intensity_value = 1.0;
else if (intensity_value < 0.0)
intensity_value = 0.0;
_modulation_intensity = intensity_value * (1 - MODULATION_MAX_FACTOR) * 2 * _delay_length;
}

@ -47,14 +47,12 @@ class AudioEffectModulatedDelay :
boolean begin(short *delayline, int delay_length);
virtual void update(void);
virtual float offset(float offset_value);
virtual void intensity(float intensity_value);
private:
audio_block_t *inputQueueArray[2];
int16_t *_delayline;
uint16_t _circ_idx;
uint16_t _delay_offset;
uint16_t _modulation_intensity;
uint16_t _delay_length;
int16_t c_mod_idx;
uint16_t idx[2];

Loading…
Cancel
Save