Release section of envelope issues
@zonkmachine is already working on this.
Since May 9, 2024.
- Dominant language
- C++
- Stars
- 10.4k
- Forks
- 1.3k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 7
Description
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](https://github.com/LMMS/lmms/blob/v1.2.0-rc7/src/core/EnvelopeAndLfoParameters.cpp) and is the way `m_rEnv` is computed in `void 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]` or `m_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), so `m_rEnv[0]` should be 1, whereas, by the way it's filled in `updateSampleVars` function, `m_rEnv[0]` is `m_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 if `m_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](https://github.com/LMMS/lmms/blob/a2685c1cca3ef20e317d69eccb915f9d7b05e349/src/core/EnvelopeAndLfoParameters.cpp#L497) 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](https://github.com/LMMS/lmms/files/2505705/ClickExamples.zip)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.