LMMS / lmms

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

Incorrectly displayed levels in Spectrum Analyzer and Equalizer #7029

Open zynskeywolf opened 6 months ago

zynskeywolf commented 6 months ago

Steps to reproduce:

The dB values shown on the volume knob and on the Analyzer and on the Eq have nothing to do with each other, both plugins lie, differently even. Bug proven to exists in 1.3.0-alpha.1.488+g4eba656bd but has been there for a long while now.

he29-net commented 6 months ago

The Spectrum Analyzer is calibrated for dBFS units. I.e., a sine wave spanning values from 1.0 to -1.0 will read 0 dBFS. Then it drops roughly by 3 dBFS each time the amplitude is halved. So Spectrum Analyzer is not lying; as far as I know it uses the "industry standard" scale and behaves as expected.

The Equalizer, it seems, uses a different scale, where 6 dB = 0 dBFS. That's not technically "lying" either, because the dB scale is relative, and the EQ simply does not state "relative to what". But halving or doubling volume does not produce the expected -+ 3 dB changes, so excluding the arbitrary 6 dB reference point, the scale does seem wrong.

The problem with Equalizer is that the scale and grid is a part of the background bitmap, so it is not easy to change and tweak. I imagined the EQ spectrum display could be eventually replaced by parts of the new Spectrum Analyzer, but I'm no longer actively working on LMMS, so it stayed in the realm of imagination.

zynskeywolf commented 6 months ago

The Spectrum Analyzer is calibrated for dBFS units. I.e., a sine wave spanning values from 1.0 to -1.0 will read 0 dBFS. Then it drops roughly by 3 dBFS each time the amplitude is halved.

I would argue with that statement. It being a dBFS scale (what else could it be in software?) should not change the fact that halving/doubling the amplitude equals to a change of ~6 dB by definition (as long as we are in the voltage( == digital level) domain ofc). This Wikipedia article states it clearly and every other 3rd party analyzers I have tried also work this way, so I'm pretty convinced that the display of LMMS's analyzer is wrong.

he29-net commented 6 months ago

Hm, maybe the 3 dB doubling / halving related to the power of the signal then. I think it was discussed in the original Spectrum Analyzer PR at some point, and this current behavior is what I ended up using for some reason.

If there are good arguments for the change to "6 dB doubling" (matching other SW seems good enough to me) and others agree, I don't see any problem with that.

It could be a good first issue: just tweaking some constants, and in the case of EQ, redrawing the background and making sure the modified scale still makes sense in relation to the EQ curve drawn over it.

michaelgregorius commented 6 months ago

It seems that the equalizer does not only have a problem with the scale of the fader levels. The video below demonstrates the following problems:

https://github.com/LMMS/lmms/assets/9293269/8b1eb770-c50a-49d1-9e74-bd5665300f32

I am currently working in a branch where the fader levels are always rendered using a computed gradient instead of a pixmap and where a line at unity is rendered. While working on this I noticed that the LMMS compressor, EQ and delay seem to be using the faders in linear mode (which should be removed IMHO). I currently have the suspicion that the EQ uses the fader in linear mode and feeds it values in decibels. Using it in this way also creates problem with setting the correct unity line.

Ideally the Fader class should always get the signal values as the raw sample values so that it can transform the display as needed. If we assume that we can feed the faders anything then this creates problems.

michaelgregorius commented 6 months ago

Pull request #7038 fixes the following problems reported above: