-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release section of envelope issues #4672
Comments
I tried the changes (sorry for long time) (this branch) and, with them applied, in attached project (in zip) three 3OSC presets sound correctly, whereas without them there are clicks due to envelope discontinuity. However, when amount is zero, due to the logic of So, this doesn't resolve #3086, but seems to resolve the general problem in calculating release section of envelope addressed in this issue (#4672). |
Hi! Thanks for looking into this! I may look into your finds over the holidays, just don't hope too much... :) |
Holidays are now over and I'm back testing this.
I can confirm that this looks like a fix for the issue with transients in the envelope with amount set to ~0.5 . Needs more testing but it looks promising. @@ -490,7 +490,7 @@ void EnvelopeAndLfoParameters::updateSampleVars()
- const float rfI = ( 1.0f / m_rFrames ) * m_amount;
+ const float rfI = 1.0f / m_rFrames;
No. This was fixed in #6908 with three separate issues solved and this here is a fourth. @michaelgregorius You may want to have a look at this. |
@zonkmachine, @YurkoFlisk, for me the change removes the click. I am not sure though if the ADSRs are implemented correctly in the first place. I'm under the impression that the release stage always takes the same time to reach silence, regardless of whether it starts at full sustain, i.e. 1, or at a lower level, e.g. 0.2. This is not how others plugins (and I guess real ADSRs) behave. The current implementation is also rather resource intensive as it might create long buffers for something that should be computable. On top of that it also does memory allocation for these buffers (which I assume happen in the audio thread). It would be really great if the ADSRs would be implemented as self-contained classes which compute the next value from a minimal state. They could also implement linear and exponential decay. However, doing so would likely be the ultimate backwards compatibility headache. |
Close since #6908 got merged? |
That's a separate issue. I'm looking into this one. |
@zonkmachine hard to say if this if relevant, but I stumbled upon a variation of this - tl;dr 3osc creates clicks on keyoff due to abrupt termination of the wave - even with envs. edit: yup, I forgotten to turn all the ASDR knobs to the values needed for reasonable behaviour in current version. Seems related to this but a solution of just setting env AMT to 1.0 and release to 0.1 did the trick. |
It would be really helpful with a project that demonstrates what you're seeing. |
@zonkmachine OK, I went to the bottom of this. Not really a distinct bug, but a result of the current UI/UX decisions mixed with some quirks probably reported here plus me being LMMS newb. In my case, the envelope didn't have the full 1.0 amount, and after noticing that I still missed that the release was 0. With no lopass, it wasn't audible on the sawwave, but with lopass it got exposed, see below: Nothing to fix additionally, but definitely something to keep in mind if anyone still gets the clicks. TBH I'd set 1.0 env and > 0 release (and other reasonable env settings) as the defaults, since it's really easy to miss this, especially with no visual clue which point on the ADSR env is which (i.e. with more than one point in the same place, you might mistake one for the other etc.) - I guess that's the reason why some toolings use colours and/or letters on the env graph, Anyway, many thanks for the work on this, kudos! |
It's pretty great for transient shaping; by adjusting the amount knob on a quickly decaying envelope you can reduce the volume of the tail without cutting it off entirely. |
If I understand correctly then this is quite different to how ADSRs work in others DAWs and synths and so obviously also confusing to users who have experience with ADSRs. The amount should not have any effect on the shape of the curve itself, i.e. it should not introduce any discontinuities between any stages, e.g. the last sample of the sustain stage and the first one of the release stage. A "normal" ADSR has a continuous shape that's defined by the ADSR settings and the amount settings only attenuate that full shape, i.e. it "squeezes" it in a certain way. |
The question is what kind of fix is intended. As noted above the same ADSR envelope should be calculated for an amount of 1 and amount of 0.01. In the latter case the signal should just be attenuated by -40 dbFS (0.01 amplification) compared to the one at 1. |
@michaelgregorius @zonkmachine Regarding release duration, I'm not very familiar with other DAWs, but from what I see looking at open source code is that there are cases of both release duration being parameter of the envelope (which is what is implemented here via Btw, while we're at it, neither documentation nor GUI reflects the fact that duration of each (non-sustain) envelope stage quadratically, via Regarding ADSR shape and As an aside, I think some knobs could have their min/max values adjustable through the same dialog that now opens to change the current value upon doubleclick. It would make it possible to support wide range of values for such knobs without the need for arbitrary limits (e.g. |
Regarding the ADSRs I am under the impression that one could differentiate between two implementations:
Because analog ADSRs likely use something like capacitors that are loaded and unloaded exponentially they should not behave like the digital implementation. The reason is that they will simply start to load/unload the capacitors using the current voltage. Put differently: the analog ADSRs will not compute anything for their behavior as they have no real "knowledge" of their current state. |
This problem may be similar to #3086, but more general I think.
When the release section of envelope is entered (whether it's for volume or not) and AMT knob is somewhere between 0 and 1, there's a click even with nonzero release time, which is well noticeable if AMT is around 0.5 and sustain value is at max. Zip with 2 example presets is attached: one for volume envelope, second for cutoff envelope (with volume envelope set to AMT 1 so that it doesn't cause problems).
The issue seems to be in EnvelopeAndLfoParameters.cpp and is the way
m_rEnv
is computed invoid EnvelopeAndLfoParameters::updateSampleVars
. In particular,void EnvelopeAndLfoParameters::fillLevel
function suggests that this array is used for calculating envelope levels during release period, and it's values are multiplied by the envelope value from which the release began (m_pahdEnv[_release_begin]
orm_sustainLevel
, depending on release beginning time). So, for a continuous transition, at the first release frame this value should be multiplied by 1 (or very close to that), som_rEnv[0]
should be 1, whereas, by the way it's filled inupdateSampleVars
function,m_rEnv[0]
ism_amount
. This also explains why there's no problem when AMT is 1.What's interesting is that if
m_rEnv
is calculated starting from 1, release period should always start smoothly, so even ifm_amount
is 0 we will have release from actual value. In particular, since for the volume section default release time is already nonzero, there won't be click at the end by default, so this should resolve #3086 as well.So, it seems like change here from
const float rfI = ( 1.0f / m_rFrames ) * m_amount;
to
const float rfI = ( 1.0f / m_rFrames );
should fix the problems. I'll try to setup compilation process and test whether this will fix the problem and not introduce other ones.
ClickExamples.zip
The text was updated successfully, but these errors were encountered: