Skip to content

Conversation

@tresf
Copy link
Contributor

@tresf tresf commented Nov 8, 2017

Cherry-pick from LMMS/lmms@88b940f.

  • swh - dyson_compress_1403, fix inf/NaN
  • swh - shaper_1187, fix conditional

@zonkmachine, a second set of eyes would be nice :)

* swh - dyson_compress_1403, fix NaN
* swh - shaper_1187, division with 0
<name>Release time (s)</name>
<p>Controls the time taken for the compressor to relax its gain control over the input signal.</p>
<range min="0" max="1"/>
<range min="0.0000001" max="1"/>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I chose this number to be small enough for the value on the knobs in lmms to round off to 0. We do some odd math for our knob values so this need to be tested. The value is only used in one place though so it may be cleaner to change:
float rgainfilter = 1.0f / (release_time * sample_rate); to something like:
float rgainfilter = 1.0f / f_max(release_time * sample_rate, 1.0f);

} else if (shape < 0) {
shape = -1.0f / shape;
} else if (shapep < 0) {
shape = -1.0f / shapep;
Copy link

@zonkmachine zonkmachine Nov 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commit message says division with 0 but that's wrong. shape < 0 never is true so we drop to else for any number that is negative and feed this as exponent in a pow() operation. No fun Not the fun you intended .

@swh
Copy link
Owner

swh commented Nov 8, 2017

Sorry, I'm away on business at the moment, and don't have time to review the changes in context. Should this be merged in its current state, or are there still open questions?

@tresf
Copy link
Contributor Author

tresf commented Nov 9, 2017

Should this be merged in its current state, or are there still open questions?

We're changing the 0.0000001 out of the control and fixing it computational-side. It's cleaner. We'll send an updated commit shortly. Thanks!

tresf added 2 commits November 9, 2017 13:43
PEMDAS will allow it, but let's be consistent. ;)
@tresf
Copy link
Contributor Author

tresf commented Nov 9, 2017

@swh I think this new logic is better.

          [IN]                      [OUT]
  BEFORE: release_time: 0.25        rgainfilter: 176400.000000
  AFTER:  release_time: 0.25        rgainfilter: 176400.000000

  BEFORE: release_time: 0.001250    rgainfilter: 35280000.000000
  AFTER:  release_time: 0.001250    rgainfilter: 35280000.000000

- BEFORE: release_time: 0           rgainfilter: inf
+ AFTER:  release_time: 0           rgainfilter: 441000001536.000000

Edit: Updated input from ms (lmms), to secs (swh).

Should be good to squash and merge.

@zonkmachine
Copy link

Looks good to me.

@swh swh merged commit 1255574 into swh:master Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants