Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Main Support Categories > Multimedia & Video
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Multimedia & Video
Have multimedia question? ATI, Nvidia, Sound cards. Just ask here.

 
Thread Tools Display Modes
Old January 30th, 2009   #1
markbuntu
I got Kukis in my aspire one!
 
markbuntu's Avatar
 
Join Date: Apr 2008
Beans: 4,128
Ubuntu 9.04 Jaunty Jackalope
KDE4 Phonon and PulseAudio

KDE4 Phonon and PulseAudio on Intrepid and Jaunty

Read this entire post before doing anything!!!

If you are not using KDE4 on Intrepid 8.10 or Jaunty 9.04 do not attempt this. If you are happy with your current Kubuntu Intrepid or Jaunty KDE4 sound setup I strongly suggest that you do not do this. If you have more than one hardware sound device and are having difficulties controlling them all in KDE4/Kubuntu, this may be for you.

KDE4 comes with Phonon which is the new sound API and sound server for KDE applications. It is a partial replacement for the aRts sound server which was used in previous versions of KDE. Phonon is still very much a work in progress and it is expected that it will improve greatly as it matures so please be patient.

I have two sound cards and a usb headset and a usb webcam with a mic. I could find no reasonable way to manage all this with Phonon so I use Pulseaudio. Hopefully Phonon will be able to take over many of these functions in the future but for now Pulseaudio will do the work.

First, an important point, I installed KDE4 on top of Gnome, I use them both so I am probably using quite a few packages that do not come with the Intrepid or Jaunty Kubuntu install. Just be aware that you may need to get many packages from the repos to satisfy all the dependencies of the packages necessary for this to work if you have installed only Intrepid Kubuntu. If someone could let me know exactly what they needed to install to get all this to work properly it would be much appreciated.

Here's what I did to get PulseAudio managing all the sound for me in Intrepid KDE4.

************************************************** ************************************************** ********

Setting Up Pulse
First you need to get pulseaudio installed and set up properly if it is not already. You can get all the pulseaudio packages with your package manager. You also need to get a few other items and set up alsa, xine, gstreamer, phonon and pulseaudio for maximum usability.

Launching Pulseaudio
Pulseaudio does not start by default with KDE (for me anyway) so you need to put a launcher in System Settings/Autostart. I also made a launcher for padevchooser to get the Pulse Audio Applet in the KDE panel. You can also see post #9 in this thread for how to start pulseaudio automatically in KDE4.2

Open System Settings/Advanced/Autostart. Select Add program, type pulseaudio -D in the box and select Run in Terminal and Do not close when command exits click OK. In permissions check Is executable. In Application/Name type Pulseaudio and check that the Command is pulseadio -D so it starts with the defaults from default.pa. click OK. To set up the padevchooser launcher it is basically the same just change pulseaudio to padevchooser.

Log out, log back in and pulseaudio should be running and you should have the Pulse Audio Applet in your panel. Click on the applet and choose Volume Control.
If, when you try to open the volume control you get a message
Code:
connection refused
That means that pulseaudio is not running. This means that something is wrong with the Autostart launcher so you should check that and make sure it is set up correctly.

You can also start the pulseaudio daemon from a terminal with
Code:
pulseaudio -D
If you need to stop pulseaudio for any reason use this command
Code:
killall pulseaudio
To avoid confusion and difficulties please read through the rest of this post before following the directions in the the link since it was not written with KDE users in mind but will direct you to the the packages you need and give you some basic pulseaudio setup information if you are unfamiliar with it.

http://ubuntuforums.org/showthread.php?t=997506

For Jaunty

http://ubuntuforums.org/showthread.php?t=1130384

************************************************** *****************************
Setting up KDE4

In System Settings/Sound make default the first preferred option and in Backend you can prefer either gstreamer or xine since we will set them both up for pulseaudio. If you change these while an application is playing you may lose its sound output and need to restart the application.

ALSA setup
In Settings/Default Sound Card asoundconf.gtk choose PulseAudio. This will send everything that goes to alsa to PulseAudio. (asoundconf.gtk is a little gui that sets the alsa default sound card)

gstreamer Setup
In Settings/Multimedia System Selector/Audio/plugin select the PulseAudio Sound Server and set Device to Default.

xine setup
Start xine, open the Setup window and select the Audio tab. For audio driver to use select pulseaudio and leave device used for pulseaudio empty.

Log out and log back in and click on the Pulse Audio Applet and choose Volume Control. This will open the pulseaudio volume control. Start up Amarok or some other application that plays sound and make it play something. You should see it in the Volume Control Playback tab and all your hardware sound devices in the Output tab. You can adjust the volume sliders or mute the stream or right click on the stream and change its Output Device.

In the Settings menu you should now have Pulse Audio Preferences Sound Server Preferences. You can open that and in the Simultaneous Output tab check the box "Add virtual device for simultaneous output on all local sound cards" and have a virtual device in the Pulseaudio Volume Control/Output Devices that will direct the sound to all your sound hardware at the same time, you can direct a stream to it and control the volume like with any other output device, not a bad thing.


Sound Capture and recording
Phonon does not currently offer a alsa default device or a pulseaudio device for sound capture and recording in System Settings/Sound. For applications using Phonon there is currently no way to direct them to use the pulseaudio input devices so for now you are stuck with choosing hardware devices in System Settings/Sound for sound capture/recording. This is not so bad because Phonon gives you a lot of choices including the ability to capture hardware output streams as well as inputs.

************************************************** **********************

If you are having more general problems with setting up your sound or want some more in depth information you can always go to the 10,000 page guide here

http://ubuntuforums.org/showthread.php?t=843012


If this does not work for you or you have questions or comments or something to add concerning KDE4 and sound, please post here. This is very much a first draft but everything has to start somewhere.....and the first thing I need to know is if this creates a total nightmare for Kubuntu Intrepid users.

Best regards,
mark

Last edited by markbuntu; May 9th, 2009 at 11:05 PM..
markbuntu is offline   Reply With Quote
Old January 31st, 2009   #2
Syniurge
First Cup of Ubuntu
 
Join Date: Jan 2009
Beans: 11
Re: KDE4 Phonon and PulseAudio

Nice attempt to make things about Phonon and PulseAudio clearer for Kubuntu users

I've been curious about pulseaudio integration in Kubuntu too. In fact Phonon isn't a sound server, PulseAudio is (see http://en.opensuse.org/Sound-concepts#Phonon). And contrary to the claim in the wiki https://wiki.kubuntu.org/Kubuntu/Ubu...Parity#line-52 , PulseAudio is neither installed nor set up for Kubuntu users.
One problem then is that Amarok for KDE3 and other non-Phonon apps prevent Phonon to output sound since by default it uses the "plughw" devices and there is no software mixing (there is a workaround to make it use DMix, the ALSA way to do software mixing, but this isn't the right way to go, PulseAudio is).


Your guide is correct, other than the xine part. The "xine" command for the GUI from xine-ui has a seperate config file unrelated to Phonon.

And some additional input: to make PulseAudio appear in KDE sound panel you have to check "Show advanced devices" at the bottom-left in the panel, it's the proper way to make Phonon use PulseAudio, instead of passing through ALSA (which redirects input to PulseAudio anyway after it is configured with asoundconf.gtk).


edit: Amarok 1.x for KDE3 also has its own "xine-like" config file, so pulseaudio should be selected in Amarok settings.

re-edit: actually you dn't need to configure anything with asoundconf.gtk, Ubuntu ALSA lib already remaps to pulseaudio by default, I just catched this.

Last edited by Syniurge; February 1st, 2009 at 10:33 AM..
Syniurge is offline   Reply With Quote
Old February 1st, 2009   #3
markbuntu
I got Kukis in my aspire one!
 
markbuntu's Avatar
 
Join Date: Apr 2008
Beans: 4,128
Ubuntu 9.04 Jaunty Jackalope
Re: KDE4 Phonon and PulseAudio

First of all, thanks for your input. I am still trying to figure out exactly where Phonon fits in the sound scheme. It seems that the ultimate goal is for it to be the sound server for KDE4 so, even though it is not there yet, I mention it as such.

Due to the way I went about installing KDE4 I was unsure about Kubunutu and pulseaudio in Intrepid. I know that pulseaudio was not included in Kubuntu Hardy.

Quote:
re-edit: actually you dn't need to configure anything with asoundconf.gtk, Ubuntu ALSA lib already remaps to pulseaudio by default, I just catched this.
This was not my experience with Hardy. Some alsa apps still try to address the alsa hardware drivers directly, asoundconf ensures redirection of these apps to pulseaudio. If the alsa libs now take care of all this then asoundconf does no harm in its redundancy.

The xine-ui configures the ./xine file which is where the user defaults for the xine engine are found. If I am mistaken about this (which is entirely possible), please tell me where these defaults are written and how they can be configured.
markbuntu is offline   Reply With Quote
Old February 1st, 2009   #4
Syniurge
First Cup of Ubuntu
 
Join Date: Jan 2009
Beans: 11
Re: KDE4 Phonon and PulseAudio

Quote:
Originally Posted by markbuntu View Post
TSome alsa apps still try to address the alsa hardware drivers directly, asoundconf ensures redirection of these apps to pulseaudio. If the alsa libs now take care of all this then asoundconf does no harm in its redundancy.
I don't know about Hardy, but asoundconf produces a .asoundrc that does the same than /usr/share/alsa/pulse-alsa.conf in Intrepid.
So it is harmless but useless.


Quote:
Originally Posted by markbuntu View Post
The xine-ui configures the ./xine file which is where the user defaults for the xine engine are found. If I am mistaken about this (which is entirely possible), please tell me where these defaults are written and how they can be configured.
That could be indeed, my mistake to have been so affirmative.
I can't tell you since I don't know either and haven't found anything after a quick google trip.
Syniurge is offline   Reply With Quote
Old February 1st, 2009   #5
markbuntu
I got Kukis in my aspire one!
 
markbuntu's Avatar
 
Join Date: Apr 2008
Beans: 4,128
Ubuntu 9.04 Jaunty Jackalope
Re: KDE4 Phonon and PulseAudio

Quote:
Originally Posted by Syniurge View Post
I don't know about Hardy, but asoundconf produces a .asoundrc that does the same than /usr/share/alsa/pulse-alsa.conf in Intrepid.
So it is harmless but useless.
Well that is good to know. A lot of people misapply these sort of posts to the wrong distribution so I will probably leave that in for a while to preclude them from causing themselves and me trouble.

Quote:
That could be indeed, my mistake to have been so affirmative.
I can't tell you since I don't know either and haven't found anything after a quick google trip.
It would be nice if xine had a separate configuration gui like the Multimedia System Selector that gstreamer has. Without one we can get confused with questions like "Does the xine gui configure the xine engine?" The only reason I installed the xine player was that configuring the xine engine seemed a little obscure and I figured the xine player would clear that up.
markbuntu is offline   Reply With Quote
Old February 2nd, 2009   #6
Killerah
Just Give Me the Beans!
 
Join Date: Nov 2005
Beans: 57
Re: KDE4 Phonon and PulseAudio

Man, you're awesome! I've been looking for a way to get my audio working properly in KDE after switching over and your guide really helped me out and helped me understand what was going on with my audio better. Thanks a ton.
Killerah is offline   Reply With Quote
Old February 9th, 2009   #7
Arathorn
Just Give Me the Beans!
 
Arathorn's Avatar
 
Join Date: Oct 2005
Location: Amsterdam
Beans: 57
Kubuntu Karmic Koala (testing)
Re: KDE4 Phonon and PulseAudio

Thank you! I've gotten very irritated with sound just not working on Kubuntu but when fiddling with the Pulseaudio volume control it finally worked.
Btw, wasn;t there some thank you function on this board? I can't find it anymore.
Arathorn is offline   Reply With Quote
Old March 6th, 2009   #8
hihihi
A Carafe of Ubuntu
 
hihihi's Avatar
 
Join Date: Oct 2006
Location: Amsterdam
Beans: 153
Xubuntu 8.04 Hardy Heron
Talking Re: KDE4 Phonon and PulseAudio

markbuntu, u are my hero!!

i switched over to KDE, like u installing KDE-desktop on top of GNOME-irntrerprirdr irbrerxr (what a name) some weeks ago...

i followed your text quite closely and now i understand what i could just guess... pulseaudio is not a standard installation in kde.
aha...
making autostart pulseaudio -D did the whole trick.
i am able now to do all kinds of stuff as before on gnome, but with a beautiful breathtaking look

thank you!!!!!!!!!!
__________________
everything has an end, the sausage has two.
<<<<<<<<<<<<<<<<<<<"linux worms"
hihihi is offline   Reply With Quote
Old March 6th, 2009   #9
Syniurge
First Cup of Ubuntu
 
Join Date: Jan 2009
Beans: 11
Re: KDE4 Phonon and PulseAudio

markbuntu's post was for KDE 4.1.
As of KDE 4.2 (available in the backports), the only thing needed to get PulseAudio working within KDE is making "pulse-session" run before KDE launches using the following command in a terminal:
Code:
cp /usr/bin/pulse-session ~/.kde/env/pulse-session.sh
Then after restarting KDE, Phonon devices(not just the "PulseAudio" device) will map to PulseAudio devices instead of ALSA devices.
Syniurge is offline   Reply With Quote
Old March 6th, 2009   #10
markbuntu
I got Kukis in my aspire one!
 
markbuntu's Avatar
 
Join Date: Apr 2008
Beans: 4,128
Ubuntu 9.04 Jaunty Jackalope
Re: KDE4 Phonon and PulseAudio

Well thanks for that. I have not delved into KDE4.2 yet but I expect to be doing so soon. Then I will include specific instructions for KDE4.2.
markbuntu is offline   Reply With Quote

Bookmarks

Tags
kde 4, kubuntu 8.10, phonon, pulse audio, sound

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:50 PM.


vBulletin ©2000 - 2009, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. lingonberry