diff --git a/code/daisy-looper/daisy-looper.ino b/code/daisy-looper/daisy-looper.ino index 621936ee3c9aa3137650a64fa6b38f9d12a18703..b19ec1885feda0039f732ee8acb37ce07b295706 100644 --- a/code/daisy-looper/daisy-looper.ino +++ b/code/daisy-looper/daisy-looper.ino @@ -91,7 +91,7 @@ float rand_pitch_mod = 0.0f; // Actual audio-processing is orchestrated here void AudioCallback(float **in, float **out, size_t size) { - float output = 0.0f; + float output1, output2 = 0.0f; float out1, out2; reverb.SetFeedback(reverb_decay); reverb.SetLpFreq(reverb_tone); @@ -223,27 +223,30 @@ void AudioCallback(float **in, float **out, size_t size) { looper_out = saturate(volume * looper_out); // Mix the dry/Wet of the looper - output = drywetmix * looper_out + in[1][i] * (1.0f - drywetmix); + output1 = output2 = drywetmix * looper_out + in[1][i] * (1.0f - drywetmix); // Compress the signal - compressor.Process(output); + compressor.Process(output1); // Process reverb - reverb.Process(output, output, &out1, &out2); + reverb.Process(output1, output1, &out1, &out2); // Short decays are silent, so increase level here float dec_fac = 1.0f + (1.0f - reverb_decay) * 2.0f; out1 = out1 * dec_fac; + out2 = out2 * dec_fac; // Mix reverb with the dry signal depending on the amount dialed - output = output * (1.0f - reverbmix) + out1 * reverbmix; + output1 = output1 * (1.0f - reverbmix) + out1 * reverbmix; + output2 = output1 * (1.0f - reverbmix) + out2 * reverbmix; // Record the output if needed if (ui.rec_source == REC_SOURCE_OUT) { - ui.activeLooper()->Record(output); + ui.activeLooper()->Record(output1); } - out[0][i] = out[1][i] = output; + out[0][i] = output1; + out[1][i] = output2; } } diff --git a/code/daisy-looper/luts.h b/code/daisy-looper/luts.h index 3a2e1dfe18613f55fa9d3ce71dcf6c3b33504b73..b332ed6da58ed786d58f0a815e43280de8186beb 100644 --- a/code/daisy-looper/luts.h +++ b/code/daisy-looper/luts.h @@ -3,17 +3,12 @@ #include <MultiMap.h> -// Lookup Table for Bipolar Curve with deadband -float bip_lookup[] = {0.0, 0.08060869565217388, 0.1597391304347826, 0.23886956521739133, 0.318, 0.3971304347826087, 0.47626086956521746, 0.5, 0.5, 0.5237391304347826, 0.6028695652173913, 0.6819999999999999, 0.7611304347826088, 0.8402608695652175, 0.9193913043478261, 1.0}; -size_t bip_lookup_length = 16; - // Lookup Table for Pitch Knob float pitch_knob_lookup_x[] = {0.0, 0.0025, 0.0175, 0.0225, 0.0375, 0.0425, 0.057499999999999996, 0.0625, 0.0775, 0.0825, 0.0975, 0.10250000000000001, 0.1175, 0.1225, 0.1375, 0.14250000000000002, 0.1575, 0.1625, 0.1975, 0.2025, 0.2475, 0.2525, 0.2975, 0.3025, 0.3775, 0.3825, 0.4175, 0.4225, 0.4575, 0.4625, 0.4975, 0.5025, 0.5375000000000001, 0.5425, 0.5775000000000001, 0.5825, 0.6175, 0.6224999999999999, 0.6975, 0.7024999999999999, 0.7475, 0.7525, 0.7975000000000001, 0.8025, 0.8375, 0.8424999999999999, 0.8575, 0.8624999999999999, 0.8775000000000001, 0.8825, 0.8975000000000001, 0.9025, 0.9175000000000001, 0.9225, 0.9375, 0.9424999999999999, 0.9575, 0.9624999999999999, 0.9775, 0.9824999999999999, 0.9975, 1.0}; float pitch_knob_lookup_y[] = {-1.0, -1.0, -0.9, -0.9, -0.8, -0.8, -0.7, -0.7, -0.6, -0.6, -0.5, -0.5, -0.4, -0.4, -0.3, -0.3, -0.2, -0.2, -0.1, -0.1, -0.05, -0.05, -0.025, -0.025, -0.0125, -0.0125, -0.00625, -0.00625, -0.003125, -0.003125, 0.0, 0.0, 0.003125, 0.003125, 0.00625, 0.00625, 0.0125, 0.0125, 0.025, 0.025, 0.05, 0.05, 0.1, 0.1, 0.2, 0.2, 0.3, 0.3, 0.4, 0.4, 0.5, 0.5, 0.6, 0.6, 0.7, 0.7, 0.8, 0.8, 0.9, 0.9, 1.0, 1.0}; size_t pitch_knob_lookup_length = 62; - class Easer { float output = 0.0f; float delta = 0.0f; @@ -36,7 +31,6 @@ Easer::Easer() { }; - float lerp(float a, float b, float f) { f = min(1.0f, max(0.0f, f)); @@ -45,19 +39,6 @@ float lerp(float a, float b, float f) { else { return a * (1.0f-f) + b * f; } } -float get_from_table(float* table, float f, size_t length) { - f = min(1.0f, max(0.0f, f)); - float pos = (length-1) * f; - float pos_frac = fmod(pos, 1.0f); - if (pos_frac == 0.0f) { - return table[int(pos)]; - } - float a = table[int(floor(pos))]; - float b = table[int(ceil(pos))]; - if (a == b) { return a; } - return lerp(a, b, pos_frac); -} - float get_from_xy_table(float* xtable, float* ytable, float f, size_t length) { return multiMap<float>(f, xtable, ytable, length); } diff --git a/code/daisy-looper/potentiometers.h b/code/daisy-looper/potentiometers.h index f5e6aa356f3f2ee7dcb6bc44f7d14fa226f5c1f4..055264c4d6e2de012b6d3dbbb39f072120a5487a 100644 --- a/code/daisy-looper/potentiometers.h +++ b/code/daisy-looper/potentiometers.h @@ -55,7 +55,6 @@ class Potentiometer { Potentiometer(int pin); void init(); void setLinear(); - void setBipolar(); void setPitch(); void setSwitch(); float read(); @@ -85,10 +84,6 @@ void Potentiometer::setLinear() { this->mode = POT_MODE_LIN; } -void Potentiometer::setBipolar() { - this->mode = POT_MODE_BIP; -} - void Potentiometer::setPitch() { this->mode = POT_MODE_PITCH; } @@ -122,10 +117,6 @@ float Potentiometer::read() { // Depending on the Mode switch (this->mode) { - case POT_MODE_BIP: - current_reading = get_from_table(bip_lookup, current_reading, bip_lookup_length); - current_reading = (current_reading - 0.5f) * 2.0f; - break; case POT_MODE_PITCH: current_reading = get_from_xy_table(pitch_knob_lookup_x, pitch_knob_lookup_y, current_reading, pitch_knob_lookup_length); break; diff --git a/code/daisy-looper/ui.h b/code/daisy-looper/ui.h index 3dcb82e14414cbc1350cdec79ef0360e94c5fd7b..1036bd1fae6bf56104657393526220a680164afb 100644 --- a/code/daisy-looper/ui.h +++ b/code/daisy-looper/ui.h @@ -92,7 +92,7 @@ enum FXMode { FX_MODE_NONE, FX_MODE_LFO, FX_MODE_GRAIN, - FX_MODE_EMPTY, + FX_MODE_FILTER, FX_MODE_LAST, }; @@ -464,6 +464,14 @@ class Ui { pot_7.setDisplayMode("Grain Var.", 100.0f, POT_DISPLAY_MODE_PERCENT); }); + // Select the active Effect (FILTER) + button_5.onPress([this, n](){ + fx_mode = FX_MODE_FILTER; + pot_5.setDisplayMode("Lowpass", 100.0f, POT_DISPLAY_MODE_PERCENT); + pot_6.setDisplayMode("Highpass", 100.0f, POT_DISPLAY_MODE_PERCENT); + pot_7.setDisplayMode("Resonance", 100.0f, POT_DISPLAY_MODE_PERCENT); + }); + // Store the last ui mode, for the check on top last_ui_mode = ui_mode; }