KMix, PulseAudio Streams, and Volume Levels

When I raise the volume in, for example, Amarok, it bumps up the master volume for the entire system. If I lower the volume for Amarok, either in Amarok’s GUI or in KMix, the master volume stays at the same level post-volume adjustment. The problem with this implementation is that when a system sound plays, it’s (by default) going to play at the volume that the master volume is set to, which could potentially get bumped up to a high level and cause hearing damage – especially with people wearing headphones, or just be a plain annoyance. In KMix, you can grab a short-lived PulseAudio stream (e.g., libcanberra) for the duration that it plays to adjust the volume, which is a confusing implementation for a user to have to adjust the volume of the system sounds. Another example of grabbing a short-lived stream would be enabling “Volume Feedback” in the “Configure KMix” dialogue, raising the master volume while watching for “Unknown Application: audio-volume-change”, and quickly lowering the level while the stream is still appearing. To get that level back to the same level which follows the master volume, the user has to quickly readjust the stream while it’s still appearing. Isn’t there a better implementation than this? Why are libcanberra and the stream for the volume feedback not using the same stream, meaning, why are they separate? Is there a way with PulseAudio and KMix to set streams to not disappear as quickly, and is there a way I can pull up the full mixer, not just the front end for PulseAudio?

I know PulseAudio was a stopgap measure to fill in the voids where ALSA falls short, but there is still more work to be done, especially considering the less technical group of people who need something simple, functional, and not cumbersome.

By the “full mixer” you may be referring to alsamixer (it also interfaces with P/A). I believe you would need to suspend P/A (or disable it as opposed to removing it totally) in order to get a full mixer (KMix or alsamixer), since KMix and alsamixer by default work above P/A in the audio stack. Alternatively you could look for a mixer that doesn’t know about P/A and that interfaces directly to alsa. However, you then lose the features of P/A.

Your post is interesting wrt the overall relationship between Master Volume and application volume with P/A. I always thought that altering Master Volume should override any application program’s volume, either running or when it first opens. Then changing an application volume shouldn’t affect other applications’ individual setting or that of the Master, until Master is manually altered again. It doesn’t seem to work that way on KDE, although it did once for a while but later reverted. I have found the execution of P/A’s volume flexibility to be rather muddled. Is it an openSUSE implementation issue, or a DE issue, or even individual applications e.g. VLC doing their own thing? I haven’t done enough testing to find the answer so far.

I dont think its an individual application thing since the weird volume change to master is done by all applications (in my experience anyways). One thing that is interesting is that in kde, kmix does that strange volume change and this seems to occur in pavucontrol too (compare the playback tab and the output devices tab; you may have to move the mouse over the controls to see the change to the master channel).

Strangely, I went into gnome and tried this with the gnome volume control and it does not seem to be affected by this (comparing the applications tab changes to the “Output Volume” at the top). But then I tried this again but this time with pavucontrol open and with the output devices tab open and it moved the master forward when the applications volume was higher than the master channel.

So it is probably not a DE issue but some pulse/opensuse issue.

Try xfce-mixer you can use it in kde

That seems to be right. I did some more testing with both a 12.2 system (KDE 4.8.5 and P/A 1.1) and latest Tumbleweed (advanced 13.1ish KDE 4.11.4 and P/A 4.0). In both systems, VLC and Amarok could increase KDE’s Master Volume, once they reached its current setting. IMO that defeats the purpose of per application Volume setting claimed by the P/A developer(s).

One thing that is interesting is that in kde, kmix does that strange volume change and this seems to occur in pavucontrol too (compare the playback tab and the output devices tab; you may have to move the mouse over the controls to see the change to the master channel).

To me that suggests it’s a KDE issue, but then:

Strangely, I went into gnome and tried this with the gnome volume control and it does not seem to be affected by this (comparing the applications tab changes to the “Output Volume” at the top). But then I tried this again but this time with pavucontrol open and with the output devices tab open and it moved the master forward when the applications volume was higher than the master channel.

So it is probably not a DE issue but some pulse/opensuse issue.

Hmmm why would P/A shoot its own feature? Makes no sense. Anyone tested this on Fedora for example? :\

Then there is the mismatch between KDE/KMix reported volume percentage and those of VLC (uses a 125% scale in settings) and Amarok (uses 100% scale). Something to do with KDE/KMix and amplified volume I guess. It’s not very helpful to users. :wink:

Application volume should operate within the confines of what the user has set the master volume to. For example, if the master volume is set at 30% and Amarok is set to 100%, the master volume should never be raised above 30%. Like I said in my OP, raising an application’s volume raises the master volume if it goes beyond the point which the master volume is set, whilst lowering an application’s volume does not. Because the system sounds (by default) play at the same level as the master volume, one may be under the assumption that lowering an application’s volume would make the master volume follow it, but they may be in for a surprise if a system sound plays. With the current implementation, I will raise the application volume when needed, then lower the master volume, as the master volume is the parent to the application volume. There should be an option with PulseAudio to allow streams to linger for a set time period, so a user who accidentally sets one of the system sound levels out of synch with the master volume can easily change it. As it stands now with KMix and PulseAudio, the user has only seconds or less to readjust the system sound volume stream depending on the length of the sound being played. There also should be an option to pull up the full ALSA Mixer without having to disable or uninstall PulseAudio, or install a mixer from a different desktop environment. I tried OpenSuse 13.1 without PulseAudio installed, and was getting popping noises at the beginning of songs while playing tracks in VLC. I tried every output setting possible, and it wouldn’t go away. Then I tried OpenSuse 13.1 with PulseAudio installed and the problem disappeared. This leads me to believe that certain applications are relying on PulseAudio, and may incur problems if it’s not installed.

I don’t know if there’s a bug report on this issue yet or not, but I have not found anything yet, and can file one if need be. Thank you for reading and to those who have replied.

You should use paragraphs, it makes it easier to read lots of text :slight_smile:

As for the reliance on pulse, I think that for some applications you can force them to use alsa “properly” by editing some file (cant remember which, sorry)

I did, notice the subject change? If you’re having trouble reading a small paragraph, I don’t know what to really tell you.

Try to set the option “flat-volumes = no” in /etc/pulse/daemon.conf.

There also should be an option to pull up the full ALSA Mixer without having to disable or uninstall PulseAudio, or install a mixer from a different desktop environment.

There is: just run KMix with the environment variable KMIX_PULSEAUDIO_DISABLE set, i.e. run it like this:

KMIX_PULSEAUDIO_DISABLE=1 kmix

You may have to quit a running KMix first though.

Or set that variable in /etc/environment to do this globally and system-wide.

I tried OpenSuse 13.1 without PulseAudio installed, and was getting popping noises at the beginning of songs while playing tracks in VLC. I tried every output setting possible, and it wouldn’t go away. Then I tried OpenSuse 13.1 with PulseAudio installed and the problem disappeared. This leads me to believe that certain applications are relying on PulseAudio, and may incur problems if it’s not installed.

Well, I don’t even have pulseaudio installed and everything works fine here (and always did).
So this seems to be an audio setup problem in your case.
But I have no idea where to look for a solution.

There also should be an option to pull up the full ALSA Mixer without having to disable or uninstall PulseAudio, or install a mixer from a different desktop environment.

There is: just run KMix with the environment variable KMIX_PULSEAUDIO_DISABLE set, i.e. run it like this:

KMIX_PULSEAUDIO_DISABLE=1 kmix

I had also wondered about this. Good to know.

I confess I struggle to understand the difficulty noted in this thread wrt controlling volume at an application level.

My understanding is the application ‘pavucontrol’ provides that for applications, if one is using pulse audio. At least it does for me, if I were to say, play one multimedia file with smplayer and a separate file with vlc, I can adjust the audio play back separate for each player using pavucontrol. I just tested that a couple of years back and it worked, and I just tested it again seconds ago, and it still work fine.

Please, what am I missing that is causing the OP a problem ?

KMix provides this as well.
But the system tray icon only shows (and allows to adjust) the streams of currently running programs. As soon as the program quits, the slider disappears.

As I don’t use PA myself I don’t know (and can’t check ATM) how pavucontrol handles this.

But maybe if you open KMix’s window (either click on “Mixer” below the colume slider(s) or right-click on the icon an choose “Restore”) you can see all known streams there?

I think OP has 2 problems

  1. If you set Master at say 50% of the bar and you try to increase an applications volume past 50% what it does is it increases Master with the application (so that they are both equal which is strange) but when you lower the application master does not come down with it (expected behavior). The issue is that Master should not change and the applications volumes should be a percentage of the Master volume (so if Master is 50% and VLC is 80%, VLC is 80% of the 50%).

  2. When a sound is played very quickly (like a notification) it seems some of them appear as a separate program and since they play so quickly they vanish before OP can set the volume lower for them. Although for KDE system notifications, I think you can lower their volume from System Settings, or at the very least disable them.

KMix also provides that for KDE, wrt adjusting volume separately for each player (or sound apps generally). Although short-lived sound streams can present a problem wrt volume control, and I guess that is also true for “pavucontrol”.

Please, what am I missing that is causing the OP a problem ?

There is the issue that the volume controls within individual sound applications, like VLC or Amarok, can also increase the Master Volume of the mixer, beyond its current setting. The increased MV setting will persist after those players have closed, which might be unhealthy for headphone users. I don’t think you mentioned how “pavucontrol” might address that problem.

I think System level notification volume can be adjusted with ‘pavucontrol’.

I confess when I am playing multiple audio from different sources at the same time, I do NOT use the ‘master volume’ but rather I launch pavucontrol and control the volume levels individually there. I have not tested (due to my own lack of interest) what happens if one starts play with the master/PCM levels, at the same time in which one is using pavucontrol. But definitely on my PC I have no difficulty control volume levels for individual apps if I use pavucontrol.

Example of pavucontrol display for control individual app and system level volume.
http://thumbnails109.imagebam.com/30423/7b52b2304224926.jpg](http://www.imagebam.com/image/7b52b2304224926)
[click on image above for larger view]

Unless pavucontrol can prevent applications (players) from adjusting Master or System level volume, I don’t see any significant difference there to KMix.

A new KDE user starts up with Master Volume set at 44% or whatever the default is. Here is what can happen. A fairly quiet mp3 track is played with Amarok (showing volume of 44% say), so Amarok’s volume is then manually increased to 66%. That also increases Master Volume to a similar level. Concurrently, an mp4 video is opened in VLC. Ouch, that is loud!!! VLC opens with increased volume, the video was also perhaps recorded at a higher volume level, and the user is on headphones wondering why the entry volume is so high, when expecting only 44%.

I haven’t found how to set Amarok’s start-up volume independently. However, one can set VLC’s in Preferences > Audio (looks like default is 100% on scale of 125 max). VLC reports a volume that seems not to correlate easily with KDE apps’ volume (%).

As I already wrote, this can be disabled by setting “flat-volumes = no” in /etc/pulse/daemon.conf.

See also:
https://wiki.archlinux.org/index.php/PulseAudio#Clients_alter_master_output_volume_.28aka_volume_jumps_to_100.25_after_running_application.29

Noted when you posted it earlier, and not a pavucontrol setting. A potential solution to be tested, but the real issue remains the default configuration and resulting behaviour being discussed wrt its suitability for general use.

AFAIR there was a bugreport requesting changing the default to “flat-volumes = no” some time ago, which got rejected.

PS:
https://bugzilla.novell.com/show_bug.cgi?id=718728
It’s not closed yet, but the default hasn’t been changed either.
Maybe somebody should add a comment again…