LMMS / lmms

Cross-platform music production software
https://lmms.io
GNU General Public License v2.0
8.19k stars 1.01k forks source link

Dynamics processor causes waveshaping, even with the highest possible attack and decay values #1581

Closed SecondFlight closed 8 months ago

SecondFlight commented 9 years ago

I could be wrong about how the dynamics processor is supposed to work, but as I understand, it should work like a compressor with a custom curve. If you have experience with compressors, you probably know that a compressor will start doing strange things if the attack (or decay) is set to a value that is too short. If you have an attack that is too short, the compressor will change the shape of the wave because it is changing the volume so fast. Here's an example of a sine wave (roughly 50 hz) that has been run through C* Compress with the attack and decay set to 1.2 ms:

image

And here it is without:

image

Even with the low attack, there is still interpolation of some sort to keep the edges smooth.

The dynamics processor is doing something with roughly the same effect. Here are the settings I'm using to test this:

image

And here is the waveform it generates, along with the harmonics (each line represents a sine wave at that frequency - the original input was a single sine wave):

image

image

Am I wrong about how it's supposed to work, or is this a flaw in the algorithm?

diizy commented 9 years ago

On 01/09/2015 12:14 AM, SecondFlight wrote:

Am I wrong about how it's supposed to work, or is this a flaw in the algorithm?

Flaw, just one of many in the DP design. Others including the linear scale of the wavegraph (but that requires compat-break to fix so must be done in 2.0).

This particular problem however is caused by the envelope-following code... I sort of know how to get it right, I just haven't had the time to fix it properly.

SecondFlight commented 9 years ago

Ah, okay. I guess I won't use them in this project then. I'm trying to do multiband compression with dynamics processors, and they really mess up the sound. :3

SecondFlight commented 9 years ago

It does seem to work alright for straight lines though.

SecondFlight commented 5 years ago

This is something that could reasonably be solved with a (hopefully) small modification to the waveshaper plugin I'm working on. Once that plugin is done, I may be able to duplicate it and add attack and release to make a really nice compressor.

Or, like everything else in software engineering, it might be harder than it seems.

/shrug