Illegitimi non carborundum


PulseAudio Phonon Support now in KDE trunk and heading towards 4.4

I've very pleased to announce that my work on Phonon to integrate support for PulseAudio has now been committed to trunk and will form part of KDE 4.4 \o/

There were a few teething problems due to some last minute merges I did (which I clearly didn't test properly - my bad) and which I then went on to mis-interpret which led me to commit two rather silly things in phonon (a revert and then a revert of that revert!). What can I say... I need more caffeine obviously!

Update: PulseAudio 0.9.21 is now out and has all the necessary fixes to make the below patches unnecessary.

The slightly annoying news is that the support needed for this to work is not yet in a released version of PA. I do however have a simple patch for you here, that distro packagers are welcome to stealliberate from the Mandriva SVN. If you do this, you'll also need to apply this minor patch to phonon:

diff --git a/phonon/CMakeLists.txt b/phonon/CMakeLists.txt
index c5ce57a..50a3851 100644
--- a/phonon/CMakeLists.txt
+++ b/phonon/CMakeLists.txt
@@ -8,7 +8,6 @@ endif (PHONON_BUILD_EXAMPLES)


 macro_log_feature(PULSEAUDIO_FOUND "PulseAudio" "A cross-platform, networked sound server." "" FALSE "" "Allows audio playback via the PulseAudio soundserver when it is running")

Just so that it recognises your PA build.

There don't seem to be any specific bugs yet, although I am dealing with something relating to streams going AWOL with Xine, but I'm not sure the problem is in this code. Further testing and feedback is much appreciated. Feel free to report problems to me directly or assign bugs to my kde (at) <this domain> account in b.k.o.

Have fun!

Share and Enjoy:
  • Digg
  • StumbleUpon
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks
  • Slashdot
  • Alejandro Nova

    I’ve loved Mandriva 2010, but I’m planning to distro-hop once again… to Cooker 🙂 (really, I never thought you were doing it so well, guys ;)): I’ll ask you: Is Cooker in a totally broken, almost unbootable state (like Ubuntu’s alphas)? Or is it in a somewhat stable state of flux, not so stable, but stable enough to use without major breakups?

    • Colin

      Cooker is generally pretty stable IMO. It does have major borkage from time to time, but on the whole it’s pretty reliable. Although I really, really shouldn’t do it, I generally run cooker on my main work laptop! I’ve never had a situation where I’ve been in real trouble because of running cooker, but then I do follow the mailing lists/IRC fairly closes and look at the list of updated packages quite closely before installing them so I’m vaguely aware of what could break and can take some kind of restorative action if things go titsup!

      So, my official line is “don’t do it on an important machine”, but I’m openly admitting to being a hypocrite :p

  • Kåre Särs

    Simple patch 😉

    • Colin

      Hehe, yeah, probably not the best wording… simple in the sense it’s in one file rather than the separate files a la git format-patch…. the contents of said patch file don’t really fall under the “simple” category I agree :p

  • ycollet

    It’s Kaffeine and not Caffeine 🙂


  • arwa

    Will the pulseaudio backend make it possible for amarok to play ogg/vorbis-songs gaplessly? When searching a bug entry for this in amarok-bugzilla I had found the info that the problem lies in the xine backend!?

    • Colin

      Please note that this is not a backend. This is support for the existing backends’ own PulseAudio output but utilising the control and configuration system presented to KDE users. This allows PulseAudio to manage the devices (sinks and sources) and move the streams between them when required. This will allow seamless setup of all hardware, network (i.e. thin clients, Apple Airtunes and UPnP devices) and bluetooth devices in KDE.

      The existing backends in kdesupport (gstreamer and xine) both work with this PA support helper, but vlc and mplayer backends developed outside kdesupport will need some (minor) tweaking to fit in perfectly.

  • Cumulus007

    So does this mean that I will finally be able to control each application’s volume in KMix?

    • Colin

      No, not yet, but I am working on that (along with Helio) too 🙂 Not sure if it’ll be ready and tested in time for 4.4, but if it proves stable I’m sure distro packagers will backport the necessary patches.

  • Cypher


    congratulations for your excellent work. However, I’m not sure that I understand the whole stack…

    Is it something like this ?

    Play: Application -> Phonon -> Backend -> PulseAudio -> Sound System -> Device ?
    Record: Device -> Sound System -> PulseAudio -> Backend -> Phonon -> Application

    If this is the case, playing is straightforward and obvious, but recording seems complicated if PA is configured to route to a system different from the currently defined Phonon backend… isn’t it ?

    • Colin

      You’re not far way, but there is a bit of a branch there as Phonon establishes an additional (control) connection to PA to do a bit of sheparding of streams etc. It needs to do this because the backends are abstract and we cannot control more than “Please Mr Backend, can you output to PA”, which gives is little control over anything useful!. Hence our separate control connection.

      I wrote an earlier article which explains how it all works in more depth:

    • Cypher

      @Colin: thank you, I’ll read that !

      However, I cannot stop thinking that it seems very complicated (I’m not into the Linux audio stack at all, just looking at it from the outside). Do we really need that many layers ? … Yes, making it “modular” makes it easier for debugging, but doesn’t it introduce overhead ? I guess that a many-layers system is prone to misconfiguration, impacting the user directly.

      I really need to dive deeper into the Linux sound stack.

    • Colin

      Yeah there are certainly more layers than there needs to be, but I’m just fitting in to the existing framework really rather than trying to be super invasive right now. IMO multiple backends on phonon is a mistake – it would be better to have one backend per underlying platform (Linux, Windows, OSX) and not allow any changes after that (especially not by users). Doing that would have probably allowed us to be slightly less roundabout but it wouldn’t have solved all the problems and no doubt would have introduced others!

  • d2kx

    You’re doing great work, really appreciated!

  • Alex

    Reading this was almost as awesome as finding out that my DROID phone arrived. Thank you so much!

  • lucas

    No offense, but do we really need to support pulse audio in kde? Is that mean that kde 4.4 will be depend on pulse audio? sorry for my bad english

  • Harry

    Hi, great work. But if you’re working on KMix…. Could you pleasepleaseplease update the icon in the notifcation area? We’ve got that great looking yellow speaker conus in KCM, but on the desktop we’re stuck with that ugly icon that goes way back to KDE 3…

    Just a minor thing, but polish IMHO is important 🙂

  • jens

    Very cool, this closes a huge gap in KDE (imho). Thanks a lot!

  • Thanks very much for this awesome work, Colin.

  • Zoran Dimovski

    First of all great work! But, I would like to see more polish with the kmix interaction with the user. What about when I plug in usb headset, kmix finds it but there is no option to specify that I want to use my usb headset as my primary output. That should be with two/three clicks (Right click -> Primary output -> Usb Headset) and not the systemsettings way where I need to do a lot of work with my mouse to get it working. This is not a problem for me I do this with a script but when somebody (new user) is trying to change the output it should be wright in front of his nose in this case in Kmix. This is just a thought 🙂 best regards and keep up the great work.

    • Colin

      Absolutely. Couldn’t agree more. Myself and Helio are working towards supporting PA in kmix too, so this will come along in due course. Probably wont be ready for 4.4 but it’ll certainly get there in the not too distant future.

  • Pingback: Links 21/11/2009: Smartbooks and Fedora 13 Plans Appear | Boycott Novell()

  • Nice all of this is nice 🙂
    I’m having problems to integrate in a perfect way a2dp devices into phonon (because phonon only list devices which have a hint and are type softvol :()

    So at least when using PA the user will be able to use they a2dp devices without problems! I’ll make sure that 0.5 version of kbluetooth doesn’t go out without PA support.

    Btw, Is there any way of know if PA is available at “Phonon” level? I mean, just to be sure that KDE is running under PA.


    • Colin

      Hi. Yeah all the upstream (bluez) support for audio is going into PA these days anyway, so improving support for this in kbluetooth is certainly the way forward!
      There is no way to know about PA at the phonon level as of yet. In a way I’d quite like to keep this abstract if possible, although that is not to say that some more PA integration in other places is not warranted too (on my current radar are: kmix support and a KCM that will appear as an extra tab in SystemSettings -> Multimedia which will perform the same basic job as the “Configuration” tab in pavucontrol currently: i.e. changing the card profile – which includes the Bluetooth A2DP/HSP mode selection (when it’s not done automatically))
      I’m not 100% sure what specific/direct PA integration you’ll need to do in kbluetooth (maybe your were planning on supporting the card profile stuff that I ultimately want to go into the KCM mentioned above? Either way, please let me know if you want any help/advice.

  • Pingback: Звуковая библиотека Phonon теперь полностью поддерживает PulseAudio. Релиз pulseaudio 0.9.21 | PC TECH NEWS - Новости мобильного мира()

  • Pingback: KDE 4.4 includerà il supporto a PulseAudio per Phonon | Fabrizio Savella()

  • Pingback: KDE 4.4 includerà il supporto a PulseAudio per Phonon - bruno trani dot info()

  • Pingback: KDE 4.4 includerà il supporto a PulseAudio per Phonon | Risorse Free()

  • Don Rhummy

    I have been unable to find the apple airports in my network from linux (but can do so in windows). Can you point me to the code in pulse audio where the discovery is done?

    What’s confusing to me is that as far as I can tell, it should just be opening a multicast socket and talking through it, right? But for some reason it works on windows and not on linux?!

    • Colin

      Well the windows and linux stacks are completely different code, so while you can prove that everything is physically OK, it’s not surprising that differences exist between Window and Linux implementations.

      The first thing to check is whether you have enabled the relevant options in paprefs? Make sure you run this and tick the box that tells PA to discover ROAP sinks. The ROAP support is still WIP so it may not give brilliant results, but I am (slowly) working on it!

  • Pingback: TecnoWeb » Blog Archive » Le features di KDE 4.4()

  • cabrey

    Question: Could you possible rewrite or extend KDE’s kmix to expose PA’s per-application volume control? So when you click on the volume icon in the tray, the overall system volume with a slider is on the left and applications with their own independent sliders are sequentially on the right. That would be awesome! Even GNOME’s current implementation requires the user to open up another application.

    • Colin

      I’m already working on kmix support – have a peak in my Git repositories if you want a sneak preview although it is very much WIP at present. It doesn’t do per-app controls, but it will do shortly – the main problem is that there is no way for a mixer control itself to tell the kmix window to repaint itself and include any new sliders and remove any old ones… this means it shows sliders for all devices detected at startup but wont show any hotplug ones…. soon tho’ we’ll work out what is needed to fix that. Wont be ready for 4.4 but I’m sure distros that ship it will backport it if it’s deemed important enough 🙂 Take care.

  • NordicIsak

    Will Audacity work? I was using KDE based distros because they do not include pulseaudio. And as anyone who records audio with linux can tell you Pulse is not worth the trouble. Is this a sign of the future? 🙁

    • Colin

      I challenge your assertion that people believe PA is not worth the effort. I strongly believe it is worth the effort and anyone that really genuinely knows their stuff with regards to sound on linux knows that something is needed. Whether it’s PA or not is more or less irrelevant as there is quite literally *nothing* out there just now presenting itself as a credible alternative to PA. That said, I strongly believe PA is the way forward.

      With regards to Audacity, it’s been working fine with PA for a very long time. I just did some recording just now just to test and it’s flawless.

      I really with people would stop spreading FUD about things when they really don’t know the reasons for things. Even if PA does cause some disruption, it’s not to say it is either a) to blame or b) conceptually flawed. I’m happy to engage in discussions on merit of design/architecture/goals but “my app doesn’t work therefore PA is not worth the effort” style comments really annoy me. Free software is supposed to be about driving things forward as a community but to simply remove something and not provide feedback or bug reports really isn’t going to help anyone.

  • David Thurgood

    I have just today (2012-08-19) tried Audacity, to play *.wav files. There were disconcertingly loud clicks. I had to switch from PA to Alsa, now it works OK. This is on a fully uptodate xubuntu 12.04 setup. I do not not why this should be, except to say that something is broken in PA, or pehaps it is Audacity?

    • Colin

      It’s hard to say really as there are obviously thousands of people happily using Audacity on PA (including myself). I suspect the underlying problem is on of incorrect decibel information provided for your hardware. PA uses this information to set the volume sliders properly and if it’s incorrect it can result in clipping etc. As a pure alsa setup leaves all this setup to the user, it probably isn’t as obvious to create such a configuration. Could be a different issue of course, but it’s likely not quite as simple as “something broken in PA” 🙂