mirror of
https://codeberg.org/armin/chromaflock.git
synced 2026-09-01 04:10:47 +02:00
Fix filter env: modulate relative to sustain so cutoff knob stays audible at any env amount
This commit is contained in:
parent
c6378a676f
commit
d4e738c9f1
1 changed files with 10 additions and 2 deletions
|
|
@ -128,8 +128,14 @@ public:
|
|||
left *= noteVelocity * envSample;
|
||||
right *= noteVelocity * envSample;
|
||||
|
||||
// Filter cutoff with env + keytrack
|
||||
float modCutoff = filterCutoff * std::pow(2.0f, fEnvSample * filterEnvAmount * 4.0f);
|
||||
// Filter cutoff with env + keytrack.
|
||||
// Modulate RELATIVE to the envelope's sustain level so the held
|
||||
// (sustain) cutoff always equals the base cutoff knob regardless of
|
||||
// env amount — the envelope only opens above (attack) and closes
|
||||
// below (release) that centre. This keeps the cutoff knob audible
|
||||
// at any env amount instead of collapsing when env amt is lowered.
|
||||
float modCutoff = filterCutoff * std::pow(2.0f,
|
||||
(fEnvSample - filterEnvSustain) * filterEnvAmount * 4.0f);
|
||||
float keyTrackFactor = std::pow(2.0f, (static_cast<float>(currentMidiNote) - 60.0f) / 12.0f * keyTrack);
|
||||
modCutoff *= keyTrackFactor;
|
||||
|
||||
|
|
@ -191,6 +197,7 @@ public:
|
|||
filterResonance = res;
|
||||
filterType = ft;
|
||||
filterEnvAmount = fEnvAmt;
|
||||
filterEnvSustain = fSus;
|
||||
keyTrack = kTrack;
|
||||
pan = p;
|
||||
drive = std::max(drv, 1.001f);
|
||||
|
|
@ -245,6 +252,7 @@ private:
|
|||
float filterResonance = 0.7f;
|
||||
FilterType filterType = FilterType::LowPass12;
|
||||
float filterEnvAmount = 0.0f;
|
||||
float filterEnvSustain = 0.5f;
|
||||
float keyTrack = 0.5f;
|
||||
float pan = 0.0f;
|
||||
float drive = 1.5f;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue