From 1356774e8e73c86a43b787b2cc444a54341c2e75 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Tue, 16 Jul 2019 18:37:37 +0200 Subject: [PATCH] Removed chorus_intensity because modulator.amplitude can be used. --- MicroMDAEPiano.ino | 3 +-- UI.hpp | 3 +-- config.h | 2 +- effect_modulated_delay.cpp | 15 ++------------- effect_modulated_delay.h | 2 -- 5 files changed, 5 insertions(+), 20 deletions(-) diff --git a/MicroMDAEPiano.ino b/MicroMDAEPiano.ino index e49d3fa..df339a4 100644 --- a/MicroMDAEPiano.ino +++ b/MicroMDAEPiano.ino @@ -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); diff --git a/UI.hpp b/UI.hpp index f7c312d..abce7a4 100644 --- a/UI.hpp +++ b/UI.hpp @@ -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; } diff --git a/config.h b/config.h index b25883d..6e38ef8 100644 --- a/config.h +++ b/config.h @@ -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 //************************************************************************************************* diff --git a/effect_modulated_delay.cpp b/effect_modulated_delay.cpp index 960d67b..5619cb5 100644 --- a/effect_modulated_delay.cpp +++ b/effect_modulated_delay.cpp @@ -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; -} diff --git a/effect_modulated_delay.h b/effect_modulated_delay.h index 86bcc46..00de9c5 100644 --- a/effect_modulated_delay.h +++ b/effect_modulated_delay.h @@ -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];