Illegitimi non carborundum


Mix it up

Hot on the heels of my Phonon PulseAudio integration, here is another set of patches for kdemultimedia that adds PulseAudio support to KMix \o/

Quick screenie before a more detailed description:

KMix window showing two devices, one Stereo, one 5.1

What does this mean?

Well it means you will typically get three or four tabs in KMix that represent (in order), "Playback Devices", "Capture Devices", "Playback Stream" and "Capture Streams".

All the physical (and virtual) cards' output "sinks" will appear under "Playback Devices". I'm sure the names are pretty obvious so I wont explain further!

The functionality is close to pavucontrol, but with three important exceptions:

  1. There is no equiv of the "Configuration" tab to change "Profile" for a given card.
  2. There is no way to change "Ports" for a given Sink/Source (not all sound hardware supports this and it is intended to make this automatic in some cases - i.e. Headphone Jack Sensing - once it becomes reliable upstream in ALSA, but sometimes it will still be user choice (e.g. Amplified vs. Non-Amplified))
  3. There is no way to move an given application from one output to another.

For 1 and 2 I intend to (eventually) provide a KCM to go alongside the Multimedia tab. For 3 you can move "categories" of applications to different devices via the Phonon settings in System Settings -> Multimedia already thanks to my previous patches.

Where can I get it?

It's already in Mandriva Cooker or you can grab it from my Git repo here:

The master branch is upstream svn. The pulse branch is my changes. Do a clone then issue:

 git diff master..pulse >mypatch.patch

or just build it directly.

Hopefully it'll be committed to trunk soon and if all goes well it can be easily backported to Mandriva 2010 too.


Every time a new slider appears it is added to the "Shortcuts" system. This is OK for hardware devices, but for every application it can get a bit much.... I'll try and find a way to disable this (see "What's Left" below).

PulseAudio supports a pretty crazy limit on the number of channels a device or stream can have. Kmix only has support for a fairly standard set of elements. In come cases not all channels of a given device/stream may be shown in kmix due to this limitation. Stereo -> 5.1 setups should work fine tho'.

You Suck, I use PA but I want a Real Man's ALSA mixer!

Whatever floats your boat baby!


Knock yourself out!

What's Left?

I have two remaining issues that I do not think are show stoppers:

  1. Everytime a new device shows up a new Global Shortcut dialog appears. I don't think this is any different to ALSA but as I now have per-app volume control, this dialog is also shown everytime a new application plays sound. It only happens the first time a given application plays a sound, but it could still be considered annoying by some.
  2. If there are no capture streams running at startup the tab for that will never be displayed - likewise if the stream restore module in PA is not loaded (unlikely) the "Playback Streams" tab will never be displayed.
  3. There are various things that could be more efficient (e.g. refreshing the GUI for a new device or application current redraws all tabs, not just the one that has changed when a new application appears or disappears)
  4. Make KMix dumber! KMix is pretty clever and it tries to do some smart things like saving and restoring volume for you. But when PA is used, it knows better, so I need to ensure that KMix does not do any saving/restoring of actual volume values.
  5. Use application icons for per-application streams. Just for eye candy, it would be nice to use the applications own icon in the GUI.
Share and Enjoy:
  • Digg
  • StumbleUpon
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks
  • Slashdot
  • scott

    that’s awesome work. please get this stuff upstream for 4.5!

  • RafaΕ‚

    Hey, that’s great work! πŸ™‚

    Applications icons would be great for user experience.

    Personally I really would like to see fixed “There is no way to move an given application from one output to another.”. That would allow me to easily switch between internal speakers and external display (HDMI).

    So I would love to vote on this one πŸ™‚

    Anyway, great work already, thanks a lot πŸ™‚

  • How about showing both the alsa mixer controls and the pa controls but in different tabs, that way you (i) can have control over the variaous alsa switches that are useful now and then (like mic select, headphone channel…)

    • Colin

      To be honest this would be pretty complex. There is a “multi-backend” framework in kmix but it’ll be pretty confusing. One of the overriding goals of PA is to simplify user experience, and a traditional ALSA mixer is pretty much a black box of dials and knobs for all but the most experienced of users – many of the switches have bizarre names and there is an unsteady mix of options that do not always play nice with each other.

      With regards to the Headhones and Mic Select stuff, this is already abstracted in PA via it’s “Ports” system (as mentioned in the post). I don’t have this in kmix for now, but it could theoretically be added within the current UI structure – just a lack of time. With Headphones, it is intended to make the port switch automatic when support for Jack sensing is added.

      So while the sentiment is good, I (personally) don’t like the idea of mixing (ha!) and matching the two different interfaces. Kmix will likely get a major overhaul in the not too distant future and I guess these thoughts could be revisited then but the ultimate goal of the PA project is that the user is completely isolated from having to fiddle with the ALSA mixer options (albeit I’ve maybe not exposed enough of the PA functionality to do that perfectly right now).

  • Pellaeon

    Personally, moving apps between different output devices is something I do *a lot*. As in, several times per day. My speakers are connected to one device and my headphones to another. I use pavucontrol for it, but I’d love to be able to do it in KMix. The categories conceot is fine for some static defaults, but I need per-app granularity, and I don’t want to start System Settings all the time.

  • JR

    Very nice.

    Regarding moving apps between sinks, I use this a lot and would very much like to see it get included (sometime in the future). I connect my external soundcard with a really long USB cable, and then go sit down in the sofa with my headphones. With PA’s own mixer I can just drag Amarok to the new sink.

    A shame it’s too late for 4.4, but there’s always 4.5.

  • Yeah, but i want to be able to have per application volume controls AND have all master power if i need it πŸ˜‰

    (not te mention the huge array of alsa controls i have on my desktop machine for spdif etc….even sometimes need the ‘mic boost’ on the laptop to be able to hear anything from a mic on skype…which i successfully got to work with pa btw)

  • Fri13

    Without this blogpost I would not have founded this great feature on Mandriva. I ran first to test it and KMix crashed because I have not restarted it since cooker update and it was the old KMix. Then I restarted it and it was just this new awesome Kmix.

    Mandriva has be only distribution what has got the pulse audio working as it should. Dont know what other distributors have done to brake it!

    • Colin

      It is extremely easy to ship a system with a totally broken PA setup…. and it’s quite difficult to ship one with a fully integrated and working one! :p

      Just like KDE4’s shaky early releases, PA was never going to solve all the problems overnight, and as there are only a handful of people working to improve the audio experience on the desktop, it’s slow going, but we’re definitely getting there!!! πŸ™‚

  • redm

    I kinda wonder what all this PA stuff is good for?? For me it seems just to add another level of complexity. Isn’t for KDE most of the stuff done by Phonon anyway?

    • Colin

      As you’ll see from my earlier post on Phonon integration, this only works if you live in a little “every application uses Phonon” bubble. If you want the other 98% of Linux audio applications to work properly and consistently you need something underneath.

      Also Phonon is very high level (and probably ultimately destined to be replaced by the Qt Multimedia stuff) whereas PulseAudio is very much lower level and deals with a lot of different parts of a modern Linux desktop – underlying technologies such as udev, console-kit and realtime-kit; advanced techniques such as the timer based driver model (aka “glitch free”) to save power and increase battery life by reducing processor wakeups, and higher level sound systems such as BlueTooth, uPNP and Apple Airtunes, to give the ultimate sound experience that works both individually, as part of a single-seat-mutli-user desktop, a multi-seat desktop or a thin client network.

      More detailed write up of all these issues here:

  • Thomas

    will it auto-recognize that I removed PA so I don’t get the extra clutter for something that doesn’t work anyway?

  • I just have the feeling that for a user-targetted mixer this might be simply too much. That’s more a personal feeling than a statement.

    It might sound commonplace, but I really like the way OSX handle output devices, by hiding most of the complexity.

  • bearsh

    As already mentioned, moving apps between sinks is for me, besides of per apps volume the biggest plus of pulseaudio. Therefor it would be really nice to have a way to do this in kmix (or a similar app which fits in KDE). I also thinks about some sceneries, like a setup for work where Amaroks outputs over speaker set and skype over headset, a setup for relaxing where Amaroks uses main hifi system or a bluetooth setup where everything goes over a2dp… This allows a quick switch between some frequently used setups.

  • Chris

    Thanks a lot for working on this, I’m totally looking forward to PA being fully integrated into KDE.

    I have just one problem with your current plans and that were 3. “There is no way to move an given application from one output to another.”. IMHO managing categories of apps via System Settings for static / default settings is fine but more fine grained / use by use control is mandatory too. E.g. I listen to some music via speakers in a 2 person office and then my colleague comes in who doesn’t like death metal at 9am so I do 2 clicks in kmix and switch amarok output to the headphone from the speaker ;D

    E.g. give me a tab in kmix that lists all currently running apps as rows in a table and all known sound devices as columns and add a checkbox to each field to enable or disable the output for given app on given device.

    So could you please reconsider your stance regarding this? (I hope I was able to present a valid usecase / example where it would be useful) Nevertheless thanks a lot once again for working on this πŸ™‚

  • Chris

    Add: To make me totally drool add a little icon which shows a volume meter upon clicking to the checkbox so I can control the volume per device and application.

    Last but not least add such an icon at the top so I can control the master level for a given device and make the columns rearrangeable so I can have the most used ones on the left directly near the app list (iirc you said it would remember every device that was plugged in at some time and let me remove old devices / columns by right click on column header -> remove)

    Sounds a bit complex at first but if you think about it it should be pretty intuitive and then also covers 99% of the usecases in an easy way.

    Please give it a thought πŸ™‚

  • Stefan

    Holy crap! Am I ever looking forward to silencing those stupid flash games that don’t allow you to mute their music, so that I can listen to my own music in the background.

  • Rufus D

    What really bugs me in PulseAudio is volume-controlling of seldomly-playing applications. Let me clarify: Say, I run amarok to constantly play music, while skype is running. Now whenever some of my buddies go off-/online I get skype’s notification sound. However, there’s no way of adjusting skype’s volume, *since*:

    The sliders in PA’s volume control only appear *as long as* the sound is playing.

    So as soon as skype’s notification is done, the slider disappears again. As far as I understand PA (which is very little), every program that might ever want to play some sound has to register with PA. So I’d like my volume sliders to be there constantly, no matter if the program is playing some sound or not.
    Would this be possible?

    • Colin

      While the principle point is still valid, the notification sounds in Skype are now tagged properly as event sounds. Not sure it’s bubbled through to the beta yet, but I know this has been fixed as I’ve been in direct contact with the Skype devs to help them with their PA implementation. So in the future the skype sounds will just fall under the Events widget in pavucontrol, gnome-volume-control and, now, kmix πŸ™‚

      As for the problem generally, it could be nice to show the sliders for all applications we have in the stream restore database, but I don’t want to clutter the UI too much just now. Something for a small external app perhaps?

  • Chris

    Why not use a simply table that would allow you to mute / set the volume per app and audio device like I suggested above?

    IMHO it wouldn’t clutter kmix if you put it on a separate tab and kmix is precisely where people would look for such a functionality (as in why outsource it to yet another mini app?).

  • Pingback: uberVU - social comments()

  • Pingback: Links 7/1/2010: GNU/Linux Gains Among Key OEMs | Boycott Novell()

  • Pingback: Links 7/1/2010: GNU/Linux Gains Among Key OEMs | Boycott Novell()

  • Pingback: Mix it some more «

  • Pingback: Frederik's Blog » Blog Archive » Noteworthy changes 1 January – 17 January 2010 - Random thoughts of a Linux sysadmin()

  • Jim

    Really enjoyed your interview with David Abbott of Really good discussion of Pulse Audio. Thanks.

  • Dwight Paige

    Um, in Fedora 12 x86_64 KDE 4.4.1 I have a problem with volume jumping to 100% on most kmix channels and pavucontrol output channel when booting. I don’t know the equivalent db level but the dog and the wife don’t like it… This happens when booting into F12 NOT with logout/login. [When I logout/login volume settings remain the same.] Any way to control this??? I’d be happy to provide info or steps I’ve tried or whatever it takes to resolve this. Been chasing this for months with no success other than removing pulseaudio [or in Mandriva disabling it]. But is removing/disabling pulseaudio really a good fix for someone who uses many multimedia apps? This topic does not generate many helpful or positive posts on forums so far…

    • Colin

      This is an interesting one.What login manager are you using? If it’s GDM then I’m more confused, if it’s KDM then it’s possible. Also (just to confuse things further), the Mandriva GDM is older than the Fedora one and could also cause the issue in some capacity.

      I appreciate the above sentence may not make much sense πŸ™‚ Allow me to explain. There are generally three levels of volume restoration. One is at the alsa level. When the machine is shut down or booted, the system-wide sound volumes are saved or restored respectively. These days (i.e. with newer GDM) this will only matter once – i.e. the very first boot of a fresh install. As GDM starts up it also starts a pulseaudio daemon for the pseudo session started for the GDM login prompt. This will internally save and restore device volumes, so it has inherited the system-wide volumes on the very first use, but thereafter it will have it’s own copy. The third level of restoration is when a real user logs in. This user will get their own PA daemon and will again inherit the value currently set on very first login by that user, but thereafter remember the values set.

      So it seems that in your case something somewhere is setting the volume very high. The confusing part is that because PA will save and restore the volumes itself, it shouldn’t really matter if the initial (i.e. at boot) volume is totally insane as once the user logs in their save settings from PA should override it. To be honest it sounds like module-stream-restore is simply not loaded into your PA setup, but I presume that is not the case.

      Regardless, I recommend you open a Fedora or Mdv bug report about this. Turn on all logging in daemon.conf and post the relevant sections of your syslog to the bug report. Make sure you demonstrate the problem and if possible annotate your log with a few “I logged in here”, “I logged out here” style comments.


      • Colin

        Oh and one other thing, I presume the kmix you are using is the modified version with PA support? I did speak to the Fedora guys in charge of it so know they were looking to include support for it, but just wanted to double check. The PA version of kmix ensures that kmix does not save/restore volumes (it does with plain alsa) as this functionality should (and does!) live inside PA, not an external mixer. If you are using an older kmix, please ensure you configure it to not restore device volumes.

  • Pingback: kmix have pulseaudio support? - openSUSE Forums()