1. 59

Context:

If you’re a PulseAudio user on Linux, you might have experience this feature: When you change the volume in an application, it changes the system volume at the same rate.

This feature is called “flat volume” and seems to be targeted to users who do not understand the concept of a mixer. For example someone might turn up the volume of an application (i.e. Spotify or Youtube) all the way up while the system volume is very low or even at zero and wonder why “it” isn’t working.

On a first glance, this might seem reasonable. However, speaking from personal experience, it’s actually physically dangerous. Some applications take pro-active control over the volume (for example Zoom). If you’re wearing headphones and some application forces the volume to 100%, you might be in for some ringing ears or even permanently damaged hearing.

  1. 21

    This brings back painful memories! It’s not a new feature: was there several years ago at least, if not from the beginning. (Edit to add: it was introduced in 2009: https://www.phoronix.com/scan.php?page=news_item&px=NzIwMg)

    So, one day I was happily watching some video and then, out of the blue, BAMMM!! FULL BLAST AUDIO PIERCING MY EARS!!!! Took the headphones out as fast as I could, but was rattled by the experience. WHAT ON EARTH DID JUST HAPPEN?

    Ok, so the fear receded as months passed without incident. I got complacent. I shouldn’t have. Without a warning, without an apology, PULSEAUDIO WAS DRILLING THROUGH MY EARS AGAIN!!!! Still no idea what was going on.

    Some time passed, I tried to find some clues in the meantime but did not find anything. When it happened again, I doubled down on my search. Pulled every straw I could grasp at. Found a bug report where some poor soul was describing the same thing, but there was no response. Then one day came across a response in one the StackExchange sites (maybe Stack Overflow), where someone mentioned this mis-feature.

    The puzzle started to take shape: it had always happened while I was watching videos with VLC. At the time, I used it as my go-to video player, so that was pretty much every day. It comes pre-configured to interpret touchpad scroll events as volume control. Touchpads (or the Linux driver) some times mistake a finger stroke as done with two fingers, thus scroll. VLC at the time allowed setting the volume to 150%.

    That was it: I would move the cursor somewhere across the screen upwards looking for a menu but it would be interpreted as upwards scroll, VLC would max out its volume at 150% (no problem because I used the master volume as a limiter: put application volume at 100% always and adjust master), and then PulseAudio would go “ALL THE WAY TO THE MOON!! YEE-HAW!” and max out all volume controls.

    I promptly removed Debian from my computer, and went back to Ubuntu. You see, Ubuntu had this flat-volume setting disabled by default in PulseAudio, but Debian left it as Poettering intended, active. That explained why I had not experienced it before I switched to Debian.

    I don’t use VLC any more. I still install it, have enjoyed it for years, but it’s now relegated to back-up video player in case the primary fails to play something.

    There is no escaping PulseAudio, though. I upgraded to Ubuntu 19.04 (clean install in two different computers, desktop and laptop) and now audio over DisplayPort does not work any more, and even the devices that work fail from time to time. Got best results with an external USB sound card, which I can unplug/re-plug to get things working again when the audio quality degrades suddenly to guttural seismic displacement sounds or just goes silent.

    1. 3

      I haven’t experienced this exact issue, but I experienced a lot of cases of this sort of seemingly random and very difficult to track down misbehavior when I tried to use Linux on the Desktop. It’s the sort of thing that turned me off of Linux on the Desktop entirely. It isn’t any one issue like this, it’s more that things like this keep popping up at random. Windows 10 and OS X have some issues of their own, but they never seem to break fundamental behaviors like this.

      1. 1

        The main issue boils down to a difference in opinion about how real audio-engineers use their mixers. I’m not talking about software-mixers, I mean those real big clunky ones you see at concerts and in theaters. Yes those guys and girls have their own holy-wars as well, just like we have systemd vs sysvinit.

        One philosophy is to “fix” the volume on the master switch and mix everything else on a per-channel basis (in PulseAudio a program gets it’s own audio channels). This is especially useful in most playback-settings when you have to comply with environmental noise restrictions for example. “flat-volumes = no” corresponds to this philosophy.

        The other, competing philosophy is to work with all kinds of “preset”-settings in which you want to capture as much volume as possible from each individual channel and then use all the knobs and buttons on the output-channels. This is more useful in a setting where you are recording audio. “flat-volumes = yes” corresponds more or less to this philosophy.

        Both philosophies have their ups and downs and it’s kind of silly to simply prefer one above the other, but it’s a hard fact that most of us use pulseaudio in a playback setting and that most playback devices are closer in behavior to “flat-volumes = no”.

    2. 11

      This has been in my install scripts for Debian for quite some time: (Yes, I am aware this script can be improved upon)

      # Fix annoying pulseaudio settings, if not already there
      if [ $(grep -c "flat-volumes = no" /etc/pulse/daemon.conf) -lt 1 ]; then
          echo "flat-volumes = no" >> /etc/pulse/daemon.conf
      fi
      

      Every newly installed system will have this set on a system-wide level, because I’ve had multiple complaints from multiple users about the volume-mixer not working the way they expect it to work.

      So I decided to nuke this “problem” from orbit for the entire fleet to end these complaints once and for all.

      1. 3

        I’d like to see the entire script. Is it on GitHub?

        1. 2

          No, that exact script is confidential and I generally don’t post my scripts or code to github.

          But I have something similar to quickly install some of my customizations on a personal machines at home, I can share that if you want?

          1. 2

            That would be awesome if you don’t mind. I just switched to Debian and I’m curious how others customize it.

            1. 2

              Sorry for the late reply.

              I had to stick a license on it to eliminate the possibility of getting sued… Coincidentally, this is also why I usually don’t upload my code anywhere.

              You can view this horrible shell script here as a gist on GitHub

              I usually bundle this with some other scripts and .gpg files. It has been on my todo-list for ages to enhance and integrate everything into one nice script, but I simply never bothered.

              Keep in mind that this in no way reflects how I usually do things, this is just a quickly hacked together script to get a personal or family machine up and running as fast as I can. It was never supposed to be used by someone else than my partner or myself. In fact I’m a bit ashamed of it, but I just want to be helpful. As such, I might remove and update it at some point in the future.

      2. 9

        I was going to say I haven’t noticed this, that mixing with pavucontrol works exactly how I’d expect and that no application has ever changed my system volume.

        Turns out Arch’s default pulse configuration includes flat-volumes = no in /etc/pulse/daemon.conf, heh. Before blindly changing your pulse config, maybe run a quick rg flat-volumes /etc/pulse and see if your distro does it for you.

        1. 4

          Default configuration on Fedora does, too (just checked).

        2. 4

          openSUSE sets it to ‘no’ via a separate daemon.conf.d config file.

          Why PulseAudio has such a bad default setting, is beyond me.

          I really dislike PA and find that lots of audio related problems are fixed by simply killing PA daemon, from some reason.

          1. 3

            On a side note, why there is no volume safety on PulseAudio?

            Both the master and application volumes might be set very high for a number of reasons (e.g. after listening to a very quiet recording).

            Something should measure the real output volume level and prevent sudden/loud noises.

            1. 2

              There’s no way to know what the actual physical volume will be coming out of the device plugged in. One pair of headphones might sound just fine at 50% volume and other might need 10% on the same computer. Usually speakers need the volume set higher as well. Some audio cards are smart about this and can detect speakers vs headphones to an extent, but it’s not an exact science by any means.

              That said, 100% volume is almost never the right answer, and I’d love if I could get pulse audio to just never go above a certain point

              1. 1

                Of course the physical sound volume depends on many factors e.g. you can very well have an external amplifier. I wrote “output volume level”: the level on the sound card output after all the internal mixers, filters and amplifiers.

                1. 1

                  That said, 100% volume is almost never the right answer, and I’d love if I could get pulse audio to just never go above a certain point

                  Be careful what you wish for, because I can think of just about a ton of april’s fools jokes I could pull with a feature like that… But I can also think of various malicious usages for a feature like this (for example ransomware asking for 5$ to get your sound back after it set it to 10% at max).

              2. 3

                Sorry to be “that guy”, but you guys know you can disable PulseAudio completely and live a better life without you weird and non-deterministic issues?

                1. 3

                  I did this two years ago and wished I hadn’t waited so long. What a relief.

                  1. 1

                    My main gripe is SteamOS where I did a factory reset, having forgotten to backup /etc/ and lost the config that made some things not crackle. Fortunately I don’t have time to play that much and can choose unaffected games.

                    The OS should not require PA, but I worry that someshit will lock down the Alsa device and volumes can get messed up by avoiding that with software mixing…

                    Alsa benefits from having slmething on top of it but I hate it being PA, especially when PA is practically required.

                  2. 2

                    Problem: something is confusing. Solution: find a different way of making it confusing

                    :D

                    It looks like the intention for this feature may have been good, but the final result breaks the principle of least astonishment badly.

                    As it is my folks struggle to use Pulseaudio with one application (Firefox playing audio) and one TV over HDMI; the best way to simplify it for them would be to remove (not add) features. I still have unexpected complexities like audio-chipset auto-muting that bite me sometimes even though I use plain Alsa.

                    1. 1

                      A helpful PSA, thank you!

                      This reminds me of the GNOME volume step issue: by each volume up or volume down media keypress adjusts the volume by ~10%. Pair that with hardware that rapidly generates those button presses — e.g., a volume knob on a keyboard — and you can get a painful surprise!

                      These issues differ in cause, but I wonder if they point at a class of missing or ignore requirements. Do most GNOME/fd.o devs only use laptops? Laptops usually possess weak speakers, so it’s difficult to actually hurt yourself with them. The problem might seem more an annoyance than the serious issue it is.

                      1. 1

                        Related: Gnome could really use a decent volume mixer in the toolbar UI.

                        1. 0

                          Note:

                          When submitting a URL, the text field is optional and should only be used when additional context or explanation of the URL is needed. Commentary or opinion should be reserved for a comment, so that it can be voted on separately from the story.

                          1. 5

                            Dear WilhelmVonWeiner

                            Thank you for the comment. I’m new to this community and therefore it is my turn to learn the rules of this community. Therefore, I’m very grateful to any hints.

                            Having said this, I did read the guidelines before posting. And, from personal experience, I would claim that most people wouldn’t know what this post is about just from the title. Hence, I added some context to the submission. It’s neither commentary nor opinion. In fact, the context that I provided is verbatim the very beginning of the blog post.

                            Did I go wrong in my assumption that people won’t understand with more context or with the implementation that I added context by copying the beginning of the post? Or, did I read the guidelines correctly?(;

                            1. 8

                              Some people prefer to have a summary or excerpt (as you did) before going to the linked article, some others do not.

                              In any case, if you are quoting from the article it would be good to mark it as quoted text, by prefixing it with “> as documented in the “Markdown formatting available” link under the input box when you are composing your post.

                              1. 3

                                That sounds very reasonable! I’ll do that in the future. Thank you 🙏

                              2. 2

                                The contents of the post should stand on its own. There’s no need to summarize or repeat its content.

                                The text field is appropriate if the title is, for example “I’m over the moon today!” and the actual contents refers to, for example, a long-awaited release of a software project relevant to this site. Even so, information like the domain name and the tags will give context.

                              3. 3

                                The text here is taken 1:1 from the article, so while an unusual use of the text field, I’d argue that it doesn’t need to be separated from the story.

                                1. 4

                                  Plus the site has really terrible contrast and this helps. :)

                                  1. 3

                                    it’s not that unusual - it’s a fairly common practice to excerpt what you feel is the key paragraph of an article to let people know whether it’s worth their reading (and to serve as a tl;dr for people who don’t).

                                    1. 2

                                      Since you’re the oldest user of lobste.rs with the most karma in this thread, I’m happy to hear your take on this. I’m especially happy to hear that it seems that I didn’t violate the qualitative standard on my second post(;

                                      Thank you for adding your thoughts!

                                    2. 2

                                      So what’s the point in linking an article at all?