An unofficial, read-only Hacker News reader.

Windows Loudness Equalization, reverse-engineered and ported to PipeWire (opens external site)

349 points by ThrowNotAway 3 days ago | github.com | 194 comments on HN

View full thread · View on Hacker News

Comment thread (13)

  1. Please, don't confuse the things even more than required and don't use "Equalization" unless you manipulate gain in a frequency-dependent manner.

    This is loudness normalization.

    Also, from what I can see from the description, the described algorithm would be susceptible to increasing gain of focused impulses, such as whistle or other pure tones. This is why it requires additional limiting at the end.

    Do people consider Windows loudness treatment desired, so it requires a reimplementation?

    Replies (5)
    1. Consider it prompting as a service: you don't have to spend your own tokens to take a look at what Windows does.

      I, being a bit of a DSP guy, thought it was interesting to see what is being shipped at scale. The code is more of a bonus in case I want to give it a try and tweak it.

    2. I'm a CS guy who somehow landed at a DSP job, no physics or engineering background at all.

      What is equalization? The "most specific" description I can come up with is "estimating a channel and correcting for it", where "channel" specifically means, attenuation, phase, and multipath corrections, and it assumes an LTI effect (meaning things like carrier frequency offset are not included, despite it being an effect you should correct for). If that description is accurate, why is that a good characterization of a class of noise?

      Replies (3)
      1. > What is equalization?

        An equalizer is a multi-filter device that demultiplexes your sound into several channels (usually by frequency), filters each one independently, and then merges the result back.

        It has that name because it's supposed to be used for reversing the non-linearities on your sound system, so it amplifies all parts (usually frequencies) by the same amount. But the device by itself doesn't make anything equal, and many people like to use it to distort the sound, what makes the name very confusing.

        Replies (1)
        1. A "graphic equalizer" in the audio world is what you're describing (array of band passes that you independently adjust the gains of then sum back up). Parametric EQs don't necessarily split frequency bands like that, and "equalization" in the comms/RF sense can be wildly different. E.g. a viterbi decoder could be considered a form of equalization, or an MMSE. Both of which are so far off a classic bank of band passes.

          It's such an overloaded term that it ceases to mean anything other than "an algorithm that corrects for the environment".

      2. I'm an audio guy who has been learning about DSP.

        The answer you're not looking for is that people get all bent out of shape about their terms, especially when those terms are commonly abbreviated in typical parlance.

        A more-practical answer is that when people refer to equalization, they often refer to frequency-domain equalization. Traditionally accomplished with a graphic equalizer (which is "graphic" because a person can see the curve being applied on the faders[1]), or a parametric equalizer (which has than one control per band).

        The ostensible intent of frequency equalization is to make a system (and its flaws) equal across the frequency range (from 20Hz 20KHz or from DC to daylight or whatever). The term "frequency equalization" almost always gets shortened to "equalization."

        But dialects differ. Sometimes, people say[0] "equalization" and mean something in the realm of dynamic range equalization, instead. They use the term to mean an impartation of dynamic sameness, or equality.

        Perhaps this means dynamic compression, or limiting, or both. You know, to smooth out the dynamic peaks and dips in a singular track (to convert something like the 1812 Overture from a raucous affair into something that can be background music). Or, in the case of the Windows software mixer, to avoid the commonly-undesirable behavior of clipped samples.

        Or perhaps they mean peak equalization, where every track in a library is dynamically-adjusted to peak at the same reference value (of maybe 0dBFS or -3dBFS or something) and is otherwise unadjusted.

        Perhaps they mean something relating to perceptive loudness over time, instead, like equalizing LUFS[2] values between a selection of tracks so each one retains its own internal dynamics even while a softer track may be increased in amplitude and an overall-louder track may be reduced in amplitude and it is possible that none of them ever reach 0dBFS.

        But it's more common, at least in my part of the world, to refer to amplitude-domain stuff as compression, limiting, and/or normalization, and it's also more common to call all of the frequency-domain stuff equalization (even if it's just used as a tone control that is adjusted to taste in a way that has nothing at all to do with equality).

        All of these dialects can be functional, and they do convey meaningful information. But audio people have trouble communicating with eachother anyway because for all of their audio prowess, they're often just complete shit at listening.

        It's a societal issue that relates to an individual's choice of jargon. And this condition is, to be very clear, quite normal and expected.

        Up next: We'll talk about the differences between Jack, a jack plug, a quarter-inch plug, a headphone plug, a TRS plug, and a phone plug.[3]

        After that, we'll get into normalled, half-normal, and non-normal patch bays -- and how these have nothing at all to do with amplitude normalization.

        ---

        [0]: https://github.com/xoxorwr/pw-loudness-eq

        [1]: except they could be knobs instead, but that's still a "graphical" EQ

        [2]: https://en.wikipedia.org/wiki/LUFS

        [3]: They're all the same thing, except for Jack, who is not amused by the sound of his name being tarnished in this completely nonsensical intercontinental abyss of nomenclatural duress

        Replies (1)
        1. Well Actually TRS is supposed to refer to the kind with three conductors total (often two signal + one ground for stereo) and doesn't specify the size. Stands for tip–ring–sleeve, because that's what the contact points look like. You can add and remove R's to refer to different conductor counts, so an unbalanced mono cable is just a TS, and the headset I use uses an ⅛-in TRRS connector for carrying stereo signal to the headphones and mono signal from the microphone simultaneously.

          In practice I do think people often say TRS regardless of how many R are actually present. I know there's some de facto intercompatibility with incorrect ring numbers at least in consumer gear, because a mismatch will either short a signal to ground or leave it floating, but the size thing is still relevant.

          Replies (1)
          1. See what I mean? Even my above-and-beyond list of names lacks detail. :)

            And they're often interchangeable. A TS plug can connect to a TRS jack, and sometimes that's even desirable[1] for things like connecting a transformer-balanced output to a single-ended input. Or: TRS plugged into a TRRS hole can be used to detect the lack of a microphone.

            And it gets weird than that: TRS to RCA[2] adapters, with T and R shorted together in the adapter itself, are a relatively universal way to turn a normalled TRS insert point on a mixer into an output for an RCA-equipped recorder without altering signal flow within that mixer. But this same adapter won't produce any signal at all when plugged into a balanced TRS output, whether transformer-equipped or not.

            [1]: https://www.ranecommercial.com/legacy/pdf/ranenotes/Sound_Sy...

            [2]: I call them RCAs. Some others refer to them as phono, cinch, pin, or tulip connectors.

    3. Honestly tells you all you need to know about how this project came to life.

      > A broadband automatic gain control. Despite the name, it doesn't equalize the spectrum.

    4. You're right that it's a compressor or normalizer, but the name of the setting in Windows is "Loudness Equalization".

      It's off by default, you need to toggle it on by output device.

      I think its most desirable when:

      a) Your laptop speakers kinda suck

      b) You're listening to a podcast or random video in a noisy environment

      c) a+b

      Replies (1)
      1. I understand the name was copied to be recognizable, but that's not doing much service as the intersection of GNU/Linux users and those who know of the original Windows feature is much smaller than the number of regular PipeWire users who might get confused by the incorrectly used term.

        My question was more of specific features of that implementation that make it more desirable than regular stuff in EasyEffects or Libavfilter or standard loudness normalization approaches (EBU R 128, ReplayGain, etc).

        I perfectly understand when loudness normalization can be useful. My mpv input.conf has this heavy-handed line for catastrophically quiet stuff:

          f2 af toggle lavfi="acompressor=threshold=0.75:ratio=1.8:makeup=2,loudnorm=i=-12:lra=8"
    5. Thanks, this is the comment I wanted to see or write. I've been struggling to understand how sine waves and their phases can be so overly complicated. I am all for everyone having their own subjective preferences, and they can process signals however they like, but why ask for trouble when doing so?