Nixpkgs: PulseAudio: Disable flat volume?

Created on 7 Jan 2015  路  22Comments  路  Source: NixOS/nixpkgs

Flat volume is enabled by default. I think we should disable it because this option could damage speakers/ears. What do you think?

Here is the relevant reddit post: http://www.reddit.com/r/linux/comments/2rjiaa/horrible_decisions_flat_volumes_in_pulseaudio_a/

nixos

Most helpful comment

I too think we should disable flat volumes by default. I would like move forward and implement a flatVolumes option that defaults to false if nobody objects.

All 22 comments

Why not provide a well-documented pulseaudio.flatVolumes _that defaults to upstream's_ true? There are good reasons for that, too.

The "damage" agument is, well, at least it's original.

Do you read all hardware docs and kernel help before you configure your kernel? Do you read all wiki pages before you use a Linux distro? I guess not. Why we take this stupid default setting so serious? Because it can possibly CAUSE PHYSICAL DAMAGE!

If someone doesn't read the doc, and his system crashes, it's his fault.
If someone uses your OS and he doesn't read the doc, and he's dead, it's your fault.

If you don't want to take any responsibility for this, simply say that in your disclaimer.

I don't think it's that clear. Note that high volume is a problem regardless of having flat setting.

Besides, I believe having per-application volume can be too complex/confusing for many users. https://www.reddit.com/r/linux/comments/2rjiaa/horrible_decisions_flat_volumes_in_pulseaudio_a/cnh4r3u

Alright. If many major distros decide to follow the upstream default there must be a persuasive reason. Now we know how to change the settings we can live with that. (Plus I think I have only ever had this issue with KDE system notification).

PA flat volumes are especially a problem with software that are kind of buggy, like uzbl (where audio jumps to a random volume in some cases). AFAIK, most distros doesn't follow upstream and disable flat volume by default. (Ubuntu, Arch, OpenSUSE, apparently, even Fedora disabled flat volumes) as it is considered a broken-by-design feature.

Just got bit by this. Spotify spontaneously jumped to 100% and nearly blew my ears out.

Adding the following to ~/.config/pulse/daemon.conf seems to have fixed things:

flat-volumes = no

I too think we should disable flat volumes by default. I would like move forward and implement a flatVolumes option that defaults to false if nobody objects.

(triage) status of this?

Could we disable flat-volume by default ? When I use my headphone after using my main speaker (where I raise the volume), my headphone volume is too much loud. Volume should be manage per sink.

@mikefaille: I believe "flat-volume" is about per-application volume.

@vcunat I just begin my tests. Although, I'm asking myself why others pretend that disabling "flat-volume" could help on this case https://github.com/NixOS/nixpkgs/issues/5632#issuecomment-351437293 ? Maybe, I must be more skilled in english to understand.. (well, English isn't my mother tongue)

For me the master-volume gets switched according to headphones being plugged in. I'm fairly confident I haven't overridden any defaults around sound. (English as mother-tongue is in minority in the NixOS community; most people seem to be European.)

For me too PulseAudio automatically does everything right.

This issue needs an example that demonstrates the effect of disabling "flat volume": I could not find an application that changes the global volume when it is supposed to change its own volume.

Here is my espectation (no surprise here) :
1a- we always manage global volume by default.
2a- if we change volume on specific sink, it would be relative on global volume
3- if a sink disappear and reappear (hotplug on headphone ?), pulse audio must remmember the last value according sink identity (hardware id ?)

An alternative way to do :
1b,2b- ignore global volume. By default, if we manage volume, we just manage sink volume.

My trouble :
https://github.com/NixOS/nixpkgs/issues/5632#issuecomment-351437293

FWIW, I've had the exact same sort of experience as mentioned here. On my big JBL LSR305 studio monitors it's merely embarassing (e.g having to explain to my neighbors why my speakers blasted some auto-playing web ad and subsequently woke them and their child at 3 in the morning thanks to PulseAudio defaults). But when I have my headphones on, it's much more of a problem, because I then risk having irreparable hearing loss (or at least ringing, aching ears for several hours).

Other distros/OSes seem to be split on the issue, so I'm not going to press any further. Sadly, this seems to be one of those scenarios where you have to choose between the user's experience and the user's safety.

zoom-us on nixos definitely sets system volume to 100% and blows out my eardrums with flat volumes. Skype used to do it too, but I haven't used it in a long time. I think anything making ALSA assumptions behaves poorly.

@mikefaille Your issue does not fit the description of what "flat volume" feature does. You can test if disabling it helps by doing https://github.com/NixOS/nixpkgs/issues/5632#issuecomment-233253203

@bdimcheff Thank you, I'll check it.

zoom-us on nixos definitely sets system volume to 100% and blows out my eardrums with flat volumes. Skype used to do it too, but I haven't used it in a long time. I think anything making ALSA assumptions behaves poorly.

I have the same issue with zoom-us - it always turns up the volume to 100% when joining a call. The experience is jarring to say the least.

@cstrahan's suggestion of adding flat-volumes = no to ~/.config/pulse/daemon.conf solves this issue for me but I think this setting should be the default (just like in ArchLinux).

Alternatively add the following to /etc/nixos/configuration.nix:

  hardware.pulseaudio.daemon.config = {
    flat-volumes = "no";
  };

It saves :ear:s :)

Let's do it by default, then.

I hope this doesn't derail the discussion, but even after setting flat-volumes, I was sometimes getting ridiculous volume changes. It turned out to be pulse "merging" volume controls.

Specifically, for historical reasons (an old laptop where having either Master or PCM volumes at 100% resulted in clipping), I manage my volume with an script wrapping amixer that adjusts PCM up or down a notch, and then sets Master to a matching volume. (E.g., if PCM is at 62%, volume-down nudges PCM down to 60%, and sets Master to 60%). But with this "feature", pulseaudio will, at apparently random times, merge the volumes and set PCM up to 100% and Master to, say 27% to balance it out, resulting in no (perceptible) change to volume. The next time I adjust my volume manually, PCM is at 100%, so Master is also set to 100% or thereabouts, resulting in unpleasant loudness.

I don't know if anyone else is running into this, but the only documentation I could find is the above-linked pulseaudio FAQ, a stack overflow post and similar one-offs. It turns out there's also decent documentation in the source, but it's not too easy to find.

I couldn't get any of the config fixes to work; I don't know if I'm using them wrong, they're broken, or I just didn't do the configuration right starting from NixOS's minimal setup. But since I had the workaround to just use Master in my own volume adjustments, that's much easier.

But if other people are running into this, it may be worth adding some configuration options or examples in nixpkgs to support this use case. (And if so, discussion should probably move to its own issue, not here...)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

copumpkin picture copumpkin  路  3Comments

ayyess picture ayyess  路  3Comments

copumpkin picture copumpkin  路  3Comments

ghost picture ghost  路  3Comments

spacekitteh picture spacekitteh  路  3Comments