14

I upgraded from 18 to Ubuntu 20.04 a few days ago. I listen to music through Google Play Music's website which I load in Firefox. I noticed that now Ubuntu has app specific volumes (cool). Since I stream shows and movies through Firefox I decided to crank the Firefox volume to the max and then fine-tune the volume on the website and with the system's master volume. The problem is that the sound for Firefox keeps resetting. In fact, it seems to reset with every Google Play song. I go from being able to hear my music to hearing silence. Why does this happen and can it be stopped?

Volume Levels

For the moment, I'm leaving the Firefox volume to where it defaults and increasing the volume on the website.

1
  • When I watch an mp4 video in Firefox, let it be embedded in a webpage, or opened from the disk via file:// protocol, and I use this video's HTML5 video controls to lower the volume, then I get something similar what you have on your screenshot: the Firefox tab's volume slider will "follow" what I did on the mp4 video's volume control. And then sometimes I get freshly opened tabs with the volume a little bit tuned down by default, or even, sometimes, muted completely.
    – Levente
    Mar 27, 2021 at 3:38

4 Answers 4

5

Try adding or changing flat-volumes=no setting in pulseaudio's daemon.conf:

The "daemon.conf" can be found in the following paths:

User definitions:

~/.config/pulse/daemon.conf

~/.config/pulse/daemon.conf.d/*.conf

System definitions:

/etc/pulse/daemon.conf

/etc/pulse/daemon.conf.d/*.conf

About flat-volumes:

pulse-daemon.conf(5)

flat-volumes Enable 'flat' volumes, i.e. where possible let the sink volume equal the maximum of the volumes of the inputs connected to it. Takes a boolean argument, defaults to yes.

Pulseaudio Arch Wiki

flat-volumes scales the device-volume with the volume of the "loudest" application. For example, raising the VoIP call volume will raise the hardware volume and adjust the music-player volume so it stays where it was, without having to lower the volume of the music-player manually. Defaults to yes upstream, but to no within Arch. Note: The default behavior upstream can sometimes be confusing and some applications, unaware of this feature, can set their volume to 100% at startup, potentially blowing your speakers or your ears. This is why Arch defaults to the classic (ALSA) behavior by setting this to no.

1
  • 1
    I uncommented 'flat-volumes = no', changed it to 'flat-volumes = yes' in /etc/pulse/daemon.conf, rebooted, and set Firefox volume to max and now when the song changes the volume stays the same. Thank you @mozlima ! Jul 17, 2020 at 15:26
2

I would like just elaborate more on what's written in the accepted answer.

Before I have changed anything, this was the behavior I have observed:

When I watch an mp4 video in Firefox, let it be embedded in a webpage, or opened from the disk via file:// protocol, and I use this video's HTML5 video controls to lower the volume, then I get something similar what you have on your screenshot: the Firefox tab's volume slider will "follow" what I did on the mp4 video's volume control. And then sometimes I get freshly opened tabs with the volume a little bit tuned down by default, or even, sometimes, muted completely.

Overall this can get a little frustrating sometimes, so I was eager to try out the new info.

In /etc/pulse/daemon.conf I have found the following line, as is:

; flat-volumes = no

Looks like it's commented out. So first, I uncommented it:

flat-volumes = no

Trying out Firefox, I did not seem to notice any difference to the previous behaviour.

Then I changed to:

flat-volumes = yes

After a reboot, there was a difference indeed, but an unwelcome one.

In this case the application's volume level gets tied to the master system volume level.

If the master volume is set to half, then in the gnome-control-center's Sound settings, the Firefox tab's volume will be displayed accordingly, also at half. In the sound settings, as long as I move the Firefox slider to softer than the master, the volume levels can be de-coupled; but if I move the Firefox tab's volume louder, as soon as it reaches the level the master is on, it starts to pull the master volume level with it. So when the Firefox slider reaches 100%, master will also.

(All this time the mp4 video's HTML5 volume control in the Firefox tab might stay at 100%. In other words, the mp4 vid's volume control now seems decoupled from the Firefox tab's, in the sound settings. In a way, I believe, this is what people are after; they are just unaware of the tradeoff.)

Now in a new experiment, I opened a video in Totem (the app now called Videos), and found that Totem's built-in volume slider was about two-thirds. So I pushed it up to 100%, and it took the master system volume level to 100% with it: in other words, I controlled the master system volume level from within the Totem UI (while I could have been unaware of it). Extremely bad idea; any other app emitting a sound at this point, could rip the speakers out (and your eardrums in).

So, I think, if you like your speakers and your eardrums, consider avoiding flat-volumes = yes.

1
  • 2
    Same here, my ears still bleeding
    – TikTaZ
    May 5, 2022 at 13:18
2

None of the fixes mentioned here solved this issue for me. I found a temporary workaround by visiting Firefox's about:config page and changing the media.volume_scale parameter to 3.5, which adjusted Firefox's default volume back to 100% on my system. This value might be something different for your system, so I suggest experimenting till you get it right.

Edit:

Changed the value back to 1.0 and everything seems back to normal now.

2
  • 1
    Considering that the default value for media.volume_scale is 1, this looks like a "workaround", that will possibly end up having some side-effects somewhere. This could become an even trickier situation if — as it can often happen — one forgets about ever changing this value in there.
    – Levente
    Jun 5, 2021 at 21:30
  • @Levente I agree. It looks like something broke with a Firefox update and might be fixed with a later update, in which case you'd have to remember to restore the original value.. It still works after I changed it back though, so I added that to the answer. Jun 6, 2021 at 10:39
-1

I had to uncomment flat-volumes = no and set the parameter to = yes. After rebooting the volume doesn't change now.

1
  • That's interesting, as the accepted answer says it defaults to yes! Can you add which file you edited?
    – Zanna
    Mar 27, 2021 at 2:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .