From 7f5714503539f8ab9198e816f9947c3b2a94a4f9 Mon Sep 17 00:00:00 2001 From: Oleksiy Date: Sun, 13 Sep 2026 22:05:54 +0300 Subject: [PATCH] WIP accent --- Acid/Acid.ino | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Acid/Acid.ino b/Acid/Acid.ino index b69293b..d2359b0 100644 --- a/Acid/Acid.ino +++ b/Acid/Acid.ino @@ -7,7 +7,7 @@ // This code is licenced under GPL v3 or later // todo: -// add accent handling +// debug accent handling that overloads the filter // bring back manual triggering (test conflicts with midi) // add overdrive @@ -121,10 +121,15 @@ byte MIDIChannel; byte memCode = "a"; //a = MIDI Channel stored in 1023 int driveAmount; byte notePlaying; +bool accent = false; void MIDINoteOn(byte channel, byte note, byte velocity) { notePlaying = note; noteFreq = Q16n16_mtof((int) note); + + if (velocity >= 127) { + accent = true; + } if (!MIDINotePlaying || !droneSwitchVal) { glide.setTime(2); //4 at 256, 2 at 512 control rate to avoid portamento glitches caused by 0 @@ -143,6 +148,7 @@ void MIDINoteOff(byte channel, byte note, byte velocity) { if (note == notePlaying || !droneSwitchVal) { MIDINotePlaying = false; digitalWrite(LED, HIGH); + accent = false; } } @@ -261,16 +267,16 @@ void updateControl(){ int CVInVal = mozziAnalogRead(CVIn); //Remap the values and assign to parameters - int cutoff = kMapCutoff(knob1Val); - int resonance = kMapResonance(knob2Val); + int cutoff = accent? 100 : kMapCutoff(knob1Val); + int resonance = accent? 255 : kMapResonance(knob2Val); int envMod = kMapEnvMod(knob3Val); driveAmount = kMapDrive(knob4Val); //Update Envelope Settings int attackTime = kMapAttack(knobAVal); int decayReleaseTime = kMapDecay(knobDRVal); - kEnvelope.setDecay(decayReleaseTime); - kEnvelope.setAttack(attackTime); + kEnvelope.setDecay(accent? 400 : decayReleaseTime); + kEnvelope.setAttack(accent? 3 : attackTime); //Calculate makeup Gain //makeupGain = (256L * 127) / (127 + driveAmount); // Q8 fixed-point compensation factor @@ -283,7 +289,7 @@ void updateControl(){ int env = kEnvelope.next(); - gain = env; + gain = accent? env * 2 : env; lpfr.setCutoffFreqAndResonance(constrain(cutoff + (((long)env * envMod * cutoff)>>16), 0, 255), resonance);