Skip to content
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

Softclip rework #173

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

purelygrey
Copy link

image

This is a rework of softclip functionality. I've been playing with it for a while and figured how to better organize it and make it nicer and (hopefully) less confusing/annoying.

This should go after #171

Changes

  • Changed signal flow, moved things around
  • Simplified gain compensation math
  • Precalculated static values for soft clipping algorithm, so they don't get recalculated for every sample anymore
  • Added a max value for int variables, so old projects with incorrect values do not result in broken sound (very crude so far, not sure about it, see Variable.cpp)

Some things got a little dirty, I don't know how to make it any better at this point, so feedback is welcome! Also there's some weirdness with formatting, not sure what's going on

Reasoning

Mainly there are three things that feel confusing/clunky:

  • Master control isn't actually a master fader -- it applies gain to each of the tracks, goes before saturation stage, and can get hard clipped
  • Soft clip modes all boost the volume behind the scenes, and there's no way to properly A/B when it's on and off, unless Atten is set manually, which is a pain to do and it differs for each mode;
  • Atten control only works when soft clip is on, so there's no way to control volume when you drive hard clip intentionally; it is also a linear slider and doesn't feel natural as a volume slider, there's not a lot of precision when it gets quiet

These changes should address all of these issues:

  • Old master is now pre-gain, and it does what it says, which is pretty much driving the clipping stage
  • Soft clip gain boost is turned off by default, so there's no jump in volume, unless you want it, and it's hard to accidentally switch it on or off. Easy to a/b when it's off, and boost (maximize) volume if needed
  • Atten control is now Master fader, as it should be -- works regardless of soft clip mode and feels nice to use

Signal flow explanations

Pre-gain (boost/cut)SaturationAuto-gain (boost)Hard clipMaster (cut)

This shouldn't affect old projects too much, only pre-gain will be reset to 100, which doesn't seem too bad.

Pre-gain is previous master, can cut or boost volume and does so across all 8 tracks; it'll be reset to 100 for old projects because of the internal name changes.

Saturation is the same control as before, I decided to rename it because it looked better this way :-)

Auto-gain is a switch for gain compensation algorithm, which was hidden before.

By default Auto-gain is set to normal, so there's no gain added when switching between saturation modes -- this should be generally a safer volume-wise and easier to A/B between modes. Another value, boosted, is the current behaviour.

Auto-gain control goes after Saturation control and shifted to the right, so when scrolling down normally Auto-gain control never gets active. That makes it difficult to accidentally change Auto-gain, it has to be an intentional change, which seems good because it could result in a sudden volume jump.

Hard clip is always on -- it can be used as effect when Saturation is Bypass/Subtle/Medium. When using Heavy/Insane samples should never exceed -1/1, there should be no hard clipping even if auto-gain is set to boosted.

Master is a cut-only volume fader. It is meant to be used to balance tracks against each other for playing live, etc. Because of this it goes after hard clip, so the sound of the track doesn't change (when it was hard clipped for effect). It uses x^4 curve, which feels more natural than linear, and it can go down to 0, which allows it to be used a a simple fade-in/fade-out control. 100 is unity gain as before.

Looking forward to hear your thoughts!

@purelygrey
Copy link
Author

I will update the documentation a bit later

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.

1 participant