Friday, April 15, 2016

Audio Volume improvements in Plasma 5.7

Plasma 5.4 introduced plasma-pa (new audio volume applet and KCM) to replace KMix, however it was missing few important features in the initial release. Unfortunately, there was no progress after that.
I myself have been using KMix instead, because changing application volumes from applet is a must have for me. But KMix system tray popup doesn't really integrate nicely into Plasma, so I finally decided to switch to plasma-pa and implement those missing features.

My goal is to achieve feature parity with KMix, so that I and all Plasma users can switch to plasma-pa without missing anything.

What's new?
First and most important thing for me is the ability to change application volumes from applet. That's actually the main thing I expect to be able to do from the applet as I manage volume of my sound card with global shortcuts.
There are now two tabs in applet, one for managing volume of devices and one for applications. Application streams will also display icons for easier navigation.


Another useful feature if you have multiple sound cards is to move streams to different devices. In the first draft it was possible to do so in both applet and KCM, but it was then decided to have this functionality only in KCM to keep the applet simple.
You can now also choose your default device which will be used for applet icon and global shortcuts.


Some laptops have microphone mute button, it will now be possible to assign this button to mute microphone global shortcut. Ideally it should work without any settings (if the button sends XF86AudioMicMute key event) and is the case on my laptop. Global shortcuts for changing microphone volume will also be available.

Microphone volume OSD (icon is not final)

And finally, you will also be able to change volume of notification sounds from KCM. There is a lot of changes that will make the audio management in Plasma better.

What's next?
One thing that users are requesting is volume overdrive - ability to increase volume over 100%. That's something I'd like to eventually have, but I'm not sure if it makes it into the new release.

That's it, I hope you'll like all the new features (and also fixes) that are coming with Plasma 5.7!

49 comments:

  1. About moving streams to different devices: does it mean that if I want to switch the output to a set of bluetooth headset I should use the KCM instead of using the applet? If yes, I will stay with kmix.

    ReplyDelete
    Replies
    1. Since I was the one who was against providing stream moving in the applet, let me ask a question (and I'd like everyone else who asked for this feature to chime in as well):
      What do you usually want to do when switching the output device:
      a) Switch the output device only for a single stream
      b) Switch the output device for all streams

      If a), then I would be interested what the usecase is for switching output device only for specific streams.

      I will talk more about the background of that question after we've collected some answers.

      Delete
    2. I often use external HDMI monitors with audio, and I need to stream everything to that. 90% of the time then, all streams.

      This is very hard for beginners: right now, when my mother wants to watch a movie, she has to connect the laptop, right click on the audio applet, go into configuration, select one of the ~20 HDMI profile randomly till she hears something. And do the opposite when she wants to unplug it.

      It makes no sense that it is so complicated, on Windows it JustWorks(TM).
      KDE should be simple by default, and powerful when needed!

      Delete
    3. a) you would like to stream audio to certain public, say, a party, while keep notification/alert to your private headset/bluetooth headset.

      Delete
    4. My answer is a).

      I often use my laptop connected to an LCD via HDMI to watch movies on Netflix and move only this audio stream to HDMI, keeping other streams (Hangouts, Skype, etc.) to my integrated soundcard.

      Another usecase is when I'm using an external proyector (for example when I'm teaching at the university) in an extended desktop configuration and want to test one audio or video locally (first screen and internal soundcard with phones connected) before showing it to the public.

      A third usecase is when I connect my Digitech guitar pedal via USB and move streams from/to the internal soundcard. (I understand that this is a not-so-common-usecase and have not problem in using pavucontrol for it.)

      So for now I stick with Kmix (and pavucontrol when needed).

      NOTE: if you choose to implement b) instead of a) it will be still better than we have currently :).

      Delete
    5. Mostly b) would be enough as I'm connecting laptop to projector through HDMI and that's it.

      But sometimes I play music to bluetooth audio adapter while from laptop speakers I want my games sounds.

      Delete
    6. Thank you all for the input!
      The reason why I ask is that our assumption is that b) is what the majority of users need, whereas a) is what a minority needs.
      That doesn't mean that a) is not a valid usecese, though.

      The difficult thing is just that if we enable usecase a) in the applet, we have to do it in a way that it does not complicate the UI for those who only have usecase b)

      Theoretically, Pulseaudio is supposed to make usecase b) just work automatically, like it is on Windows. Unfortunately, though, in practice way too often this does not happen. That is why we need a really easy way to do it manually.

      This is my goal for the design (and yes, what David has implemented so far is a step in the right direction, but we are not there yet). Once we have the usecase for "I want to have all my sound on one device, and I want to change which device that is because PulseAudio failed to do it for me" done, the question is how to make usecase a) work without negative impact on b)

      There are several ways to do that: One would be to have the options for a) a bit "hidden" (e.g. in a context menu), which would prevent them from confusing people who don't need them, but would of course also make it a bit more difficult for those who need them to find them.

      Another option would be to use our Alternatives system to allow users to switch between a simple and a powerful Plasmoid. This is probably best from a user's perspective, but of course also means that we'd have to maintain two volume Plasmoids (which could probably share a lot of code, but still).

      A third option would of course be "make it configurable".

      We still have to figure out what to do, but first we should get usecase b) right, because, as you said, this is something that people simply expect to work.

      Delete
    7. @Thomas Pfeiffer
      Despite drawbacks of maintaining two different plasmoids that really sounds the best for me. And the worst case would be hidden access in context menu. I already hate KMix context menus…

      Delete
    8. What about adding a button or folded section for "advance users configuration", which when unfolded would show extra options/info/etc.?

      Delete
    9. For now we've decided to go with context menu, similar to as it is in KMix.

      Having two applets is a good idea, but I'm not sure if it is really worth it (maybe if we can come up with more features that would differentiate those two applets). Sharing code is not an issue, it could be done the same way as taskmanager and icons-only taskmanager.

      Delete
    10. It would be more than just the option to move streams to devices:
      I'd imagine the simple version as a thing where you would have one master volume slider plus the option to select which output should be used, and then stream-specific volumes.
      The advanced Plasmoid, ont he other hand, would be similar to what we have now (one slider per device) and would allow to move streams.
      It would not have the concept of a "Master device" because that conflicts with the ability to choose a device for each stream.

      So the two would not differ just in certain options, but in the whole mental model.

      Delete
    11. Another use case is when using VoIP applications (jitsi, mumble, zopier..) and needs the noise-echo cancelation module provided by pulseaudio: this module creates two virtual devices (for source and sink) and your voip application input/output streams needs to be rerouted to them (at least the mic if you use headset).

      The pavucontrol applet makes this very easy to do, just 2clicks away for each stream (menu activation and choice confirmation): my parents are using this all the time to overcome their shitty hda_intel based setup lol :D

      I hope you'll find a way to implement a similar straight-forward behaviour in your new kmix applet.

      Delete
    12. Is this something that has to be done every time one uses the same VoIP application? If so, this is a pretty bad situation. This should be something you set up once, and then it automatically does the correct rerouting the next time you use the same application.

      We don't want users to have to do this every time, regardless of how straightforward it is.

      Delete
    13. I will throw my hat into this, i frequently play movies for my roomate over HDMI to the TV while i play games. It is super nice to just move the movie to the HDMI sound while everything else stays on my headphones.

      Delete
    14. Honestly, it's nice to use both of these workflows. When using KDE, I'm constantly frustrated by the inability to quickly switch all audio output from headphones to speakers like I can in Gnome - I feel that this functionality should be readily accessible from the applet.

      However, I do see circumstances where I'd want to change the destination of a particular application's sound stream (indeed, it seems many people in this thread utilise this). I think this should be available from the sound control application, but is not necessary in the applet.

      Delete
    15. We have found a nice solution at least for manually moving streams: You will be able to do that that via drag & drop!
      We still have to find a solution how to make both moving single streams and switching the device for all streams work well together, but I'm sure we will get there.

      Delete
    16. So now I've bought HDMI headphones and output stream easy and quick switch now the problem. It's quite easy in Unity. But in Kubuntu really is the pain. First question why we have HDMI devices as the same device as integrated sound card? Then it actually doesn't? I mean HDMI has nothing to do with DAC. Should be separated device then, more intuitive. About priority in KCM. Also confusing. I have group like 'all' and separated as for 'voice' 'game' and so on. I'm assuming we should have 'default' and kinda specific setup for each case if we wish, but by default orders has been placed for each group, so what actually does 'common' thing? UI issue is here.
      About
      A) sure this will be nice. For example I'm watching movie with headphones, and I don't want notification goes in them also. All other cases already has been covered in answers.
      B) Yes this is most required by default thing. At least people expect have something like this.

      Delete
  2. Nice. Application volumes is the one thing that kept me on KMix too. I was afraid it was deemed "too complicated" to the user to provide in the applet like it's done on gnome or windows 10.

    ReplyDelete
  3. great ! but i would display the applications tab first as most users have one device actually.
    thanks for your work !

    ReplyDelete
    Replies
    1. I was thinking about it too, but then went with devices tab as first because it is possible that there is no application playing sound but there will always be at least one device.

      But maybe we can think about changing it, after all applications are first tab in KCM.

      Delete
  4. Awesome, finally no more need for using pavucontrol (or kmix). My main use case however is switching output streams, so PLEASE reconsider showing that functionality only in the KCM. Maybe as a compromise add an option in the KCM to enable/disable showing that functionality in the applet as well and have it disabled by default? It's so common these days to have multiple output sources, like an internal sound card, an additional usb headset, or streaming to any dlna devices (with e.g. pulseaudio-dlna).

    ReplyDelete
    Replies
    1. Please see my reply to tosky above and please reply to it. Thx!

      Delete
  5. I agree with @tosky. The second most used feature for me is switching streams to different sound cards (internal and external) and to different set of speakers or headphones.

    Is Kmix still compatible with latest Plasma?

    ReplyDelete
  6. Great ! Thank you.

    I know it is a limitation of pulseaudio but if I were an average user I would like to see my speakers, my headset or my microphone in the device panel. What is a "built-in audio analog stereo" ?

    ReplyDelete
    Replies
    1. That is so true! Tens of configurations, all with similar names, they confuse even the most experienced geek.

      Delete
    2. You are right, that would indeed be very helpful! I don't know if it is possible to identify what a device in PA actually is with kind of information we have available, though. I'm sure David knows more...

      Delete
    3. "Built-in Audio" is name of my card and "Analog Stereo" is currently used profile. In this case it should not display the profile name, will be fixed.

      The problem with showing only strings like speakers or headset is that if you have more sound cards then there would be duplicated entries and then you'll still need to show the sound card name. Also this string comes from "port" of sound card, and not every sound card will have multiple ports (eg. I have "headphones" and "speakers" ports in internal card but only "analog output" for usb speakers which are sound card itself).

      And the biggest problem is this guessing, PulseAudio does not tell us what kind of device it is. So I prefer to show the name that comes from PulseAudio.

      Delete
    4. It was a rhetorical question. I know what it means but an average user can't understand.

      It should only display ports that have a device plugged in.
      For instance, I am quiet sure you don't have a microphone but in your screenshot you have "Built-in Audio Analog Stereo" displayed in the "Capture devices" section.

      > "if you have more sound cards then there would be duplicated entries"

      How many people have several sets of speakers plugged to different sound cards ?
      If you only show actually plugged devices you should rarely have duplicate entries.

      The problem is: does pulseaudio detect jack insertion properly ? Does it expose these data ? If not, it should be fixed. This feature works on windows since six years.

      About usb and bluetooth devices, they should display their name without problems.

      Delete
    5. I have an internal microphone in my laptop.

      Yes, PulseAudio jack detection seems to work fine (at least on my system). Showing only plugged devices is good idea, but user still may want to adjust volume before actually plugging speakers to the device. Maybe as a configuration option.

      Delete
  7. Another +1 for moving streams to different devices directly from the applet (not from KCM). Until then, I'll stick with Kmix.


    BTW the applet looks great now :)

    ReplyDelete
    Replies
    1. Please see my reply to tosky above and please reply to it. Thx!

      Delete
  8. "But KMix system tray popup doesn't really integrate nicely into Plasma, so I finally decided to switch to plasma-pa and implement those missing features."

    I don't want to sound like a basher as I am genuinely curious about it: why not improving KMix system tray popup integration instead?

    I love the open source initiative and freedom, but at the same time I am puzzled by the continued birth of new projects when the old one has a problem.

    ReplyDelete
    Replies
    1. ...because there is a limit to the integration an application systray popup can do. There are simply far more possibilities for integration for a Plasmoid than for an application tray icon popup, and this is not something we can fix because cross-desktop specifications limit us.

      Delete
  9. View this
    https://forum.kde.org/viewtopic.php?f=285&t=131935&sid=482556788c363ce8a592dd6739538d21

    ReplyDelete
  10. In the window that shows the volume level by application, is it possible to set the volume for any app or only those useing the audio?

    I am asking as Thunderbird generates a painfully loud beeb when a new e-mail comes in. When it beebs (I am still using KDE 4) the slider is added to the pop up window but as it's so short it's long gone before you can lower the volume. It would be great if you can change the volume of any application (running or not, using audio at the time or not) Is that possible?

    ReplyDelete
  11. great! i've only noticed that when i increase the volume from the hw button when i reach 100% or sometimes even lower it goes back to 66%, that's quite frustrating

    ReplyDelete
    Replies
    1. Please open bug at https://bugs.kde.org/

      Delete
  12. Thank you very much for bringing back per-application volume controlling and other "advanced" features!

    Regarding stream moving: when using headphones, I'm often loading a LADSPA equalizer plugin (via PulseAudio's module-ladspa-sink) and then moving audio streams to this new output device; this in general means moving all streams over; for simplicity I usually only move the ones really playing music though.
    Less often I also move only one stream to a virtual device for forwarding to a RasPi-based audio player.

    As a sidenote, if you want to continue improving the applet, it would also be great if it actually was resizeable (if opened from the panel) in order to have more than three items displayed at once - this might be a general Plasma problem though, since other plasmoids (networks, energy management, K menu, ...) unfortunately also lost this feature for no good reason (from a user point of view) :(

    ReplyDelete
  13. > Regarding stream moving: when using headphones, I'm often loading a LADSPA equalizer plugin (via PulseAudio's module-ladspa-sink) and then moving audio streams to this new output device; this in general means moving all streams over; for simplicity I usually only move the ones really playing music though.

    Well yes, moving all streams over should be as easy as possible.

    > Less often I also move only one stream to a virtual device for forwarding to a RasPi-based audio player.

    Well, that is something I'd see as the archetype for an "advanced usecase" ;)

    > As a sidenote, if you want to continue improving the applet, it would also be great if it actually was resizeable (if opened from the panel) in order to have more than three items displayed at once - this might be a general Plasma problem though, since other plasmoids (networks, energy management, K menu, ...) unfortunately also lost this feature for no good reason (from a user point of view) :(

    Actually, there _was_ a reason behind this: The idea was to give all systray popups the same size to avoid resizing when switching between applets in the systray.
    We have realized by now that we have probably restricted the size too much, and we're thinking about ways to rectify this.

    ReplyDelete
  14. Sounds great. And will it finally support split channel volumes? E.g. 40% on left speaker and 60% on the right - either of 100% per channel or of total, I don't care as long as the ratio is keep on volume changes?

    ReplyDelete
  15. Your work is most appreciated ! This is extremely useful, thank you !

    ReplyDelete
  16. Can you please add percentage to the OSD?

    ReplyDelete
  17. Nice applet but I stick to kmix4 because of the ugly osd. Sorry but is really annoying, is too big and too centered on the screen.

    ReplyDelete
  18. Please could you also add a user option to display the volume sliders in vertical orientation. I strongly feel that there is no benefit to having them horizontally, and the disadvantage of there being no reason for me to feel that either left or right implies increased orientation. I could learn it, but with vertical, it is natural: Up is More volume. I cannot for the life of me imagine why this had to change from the original design.

    ReplyDelete
  19. Thank you, but how can i use the new applet without the crap called PulseAudio?

    ReplyDelete
  20. I highly appreciate the ongoing development. Unfortunately the most useful feature of the old version ist missing. I loved the possibility to change the volume of all my soundcards simultaneously. In the new version turning the mouse wheel only changes the volume of the standard output.
    Could the old behaviour be restored? Maybe as an option?

    ReplyDelete
  21. Great work. Truly speaking I never seen a blog like that. Absolutely superb work. Good luck. Thanks for such an informative post. For more information visit k2 incense

    ReplyDelete
  22. Nice blog ! i would like to appreciate this stuff. Find the best Public address system PA System China

    ReplyDelete