From 7cee3b5c87856434855348759c49158d2332e1cb Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Tue, 16 Oct 2018 15:36:08 +0200 Subject: [PATCH] Added exp-curve for filter resonance setting. --- MicroDexed.ino | 9 +++++---- UI.cpp | 6 ++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index 0014c71..0c40961 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -109,7 +109,7 @@ elapsedMillis midi_timing_timestep; uint16_t midi_timing_quarter = 0; elapsedMillis long_button_pressed; uint8_t effect_filter_frq = ENC_FILTER_FRQ_STEPS; -uint8_t effect_filter_resonance = (0.07 * ENC_FILTER_RES_STEPS / 4.3) + 0.5; +uint8_t effect_filter_resonance = ENC_FILTER_RES_STEPS; uint8_t effect_filter_octave = (1.0 * ENC_FILTER_RES_STEPS / 8.0) + 0.5; uint8_t effect_delay_time = 0; uint8_t effect_delay_feedback = 0; @@ -234,14 +234,15 @@ void setup() // Init effects filter1.frequency(EXP_FUNC((float)map(effect_filter_frq, 0, ENC_FILTER_FRQ_STEPS, 0, 1024) / 150.0) * 10.0 + 80.0); - filter1.resonance(mapfloat(effect_filter_resonance, 0, ENC_FILTER_RES_STEPS, 0.7, 5.0)); + //filter1.resonance(mapfloat(effect_filter_resonance, 0, ENC_FILTER_RES_STEPS, 0.7, 5.0)); + filter1.resonance(EXP_FUNC(mapfloat(effect_filter_resonance, 0, ENC_FILTER_RES_STEPS, 0.7, 5.0))*0.044+0.61); filter1.octaveControl(mapfloat(effect_filter_octave, 0, ENC_FILTER_OCT_STEPS, 0.0, 7.0)); delay1.delay(0, mapfloat(effect_delay_feedback, 0, ENC_DELAY_TIME_STEPS, 0.0, DELAY_MAX_TIME)); // mixer1 is the feedback-adding mixer, mixer2 the whole delay (with/without feedback) mixer mixer1.gain(0, 1.0); // original signal - mixer1.gain(1, mapfloat(effect_delay_feedback, 0, 99, 0.0, 1.0)); // delay tap1 signal (feedback loop) + mixer1.gain(1, mapfloat(effect_delay_feedback, 0, 99, 0.0, 1.0)); // amount of feedback mixer2.gain(0, 1.0); // original signal - mixer2.gain(1, mapfloat(effect_delay_volume, 0, 99, 0.0, 1.0)); // delay tap1 signal (with added feedback) + mixer2.gain(1, mapfloat(effect_delay_volume, 0, 99, 0.0, 1.0)); // delayed signal (including feedback) // load default SYSEX data load_sysex(bank, voice); diff --git a/UI.cpp b/UI.cpp index 8c325ed..4decda2 100644 --- a/UI.cpp +++ b/UI.cpp @@ -303,10 +303,12 @@ void handle_ui(void) else if (enc[i].read() > ENC_FILTER_RES_STEPS) enc[i].write(ENC_FILTER_RES_STEPS); effect_filter_resonance = enc[i].read(); - filter1.resonance(mapfloat(effect_filter_resonance, 0, ENC_FILTER_RES_STEPS, 0.7, 5.0)); + //filter1.resonance(mapfloat(effect_filter_resonance, 0, ENC_FILTER_RES_STEPS, 0.7, 5.0)); + filter1.resonance(EXP_FUNC(mapfloat(effect_filter_resonance, 0, ENC_FILTER_RES_STEPS, 0.7, 5.0))*0.044+0.61); + #ifdef DEBUG Serial.print(F("Setting filter resonance to: ")); - Serial.println(mapfloat(effect_filter_resonance, 0, ENC_FILTER_RES_STEPS, 0.7, 5.0), 2); + Serial.println(EXP_FUNC(mapfloat(effect_filter_resonance, 0, ENC_FILTER_RES_STEPS, 0.7, 5.0))*0.044+0.61, 2); #endif break; case UI_MAIN_FILTER_OCT: