Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Pulseaudio
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
comprookie2000
Developer
Developer


Joined: 25 Jul 2004
Posts: 905
Location: Pompano Beach, Florida

PostPosted: Sat Aug 22, 2009 11:22 pm    Post subject: Pulseaudio Reply with quote

I am currently using pulseaudio-0.9.15-r51
on a ~amd64 system
Getting Started
First thing I did was add pulseaudio to the global USE in /etc/make.conf
Installation
Next go ahead and get your system up to date.
Code:

emerge --sync
emerge -avND world
etc-update (or dispatch-conf)
revdep-rebuild

Next lets get pulseaudio installed.
Code:

echo "media-sound/pulseaudio X alsa avahi dbus hal tcpd -gnome" >> /etc/portage/package.use
emerge -av pulseaudio paprefs pavucontrol padevchooser pavumeter
emerge gst-plugins-pulse
gpasswd -a USER pulse-access
echo "media-plugins/alsa-plugins pulseaudio" >> /etc/portage/package.use
emerge alsa-plugins

create ~/.asoundrc file
Code:

pcm.!default {
    type pulse
}

ctl.!default {
    type pulse
}


Configure Pulseaudio
Configure puleaudio by editing the files inside /etc/pulse/
Code:

client.conf  daemon.conf  default.pa  system.pa

I removed all the commented lines for easier viewing.
The first file has everything commented out.
/etc/pulse/daemon.conf
Code:

use-pid-file = yes
nice-level = -11
no-cpu-limit = no
default-sample-rate = 48000

/etc/pulse/default.pa
Code:

.nofail
load-sample-lazy pulse-hotplug /usr/share/sounds/startup3.wav
load-sample-lazy pulse-coldplug /usr/share/sounds/startup3.wav
load-sample-lazy pulse-access /usr/share/sounds/generic.wav
.fail
load-module module-device-restore
load-module module-stream-restore
load-module module-card-restore
load-module module-augment-properties
.ifexists module-hal-detect.so
load-module module-hal-detect
.else
load-module module-detect
.endif
.ifexists module-bluetooth-discover.so
load-module module-bluetooth-discover
.endif
.ifexists module-esound-protocol-unix.so
load-module module-esound-protocol-unix
.endif
load-module module-native-protocol-unix
load-module module-zeroconf-publish
.ifexists module-gconf.so
.nofail
load-module module-gconf
.fail
.endif
load-module module-default-device-restore
load-module module-rescue-streams
load-module module-always-sink
load-module module-suspend-on-idle
load-module module-console-kit
load-module module-position-event-sounds
load-module module-cork-music-on-phone

/etc/pulse/system.pa
Code:

.ifexists module-hal-detect.so
load-module module-hal-detect
.else
load-module module-detect
.endif
.ifexists module-esound-protocol-unix.so
load-module module-esound-protocol-unix
.endif
load-module module-native-protocol-unix
load-module module-stream-restore
load-module module-device-restore
load-module module-default-device-restore
load-module module-rescue-streams
load-module module-always-sink
load-module module-suspend-on-idle
load-module module-position-event-sounds

Gnome Settings
Set esd to use pulse by :
Code:

eselect esd list
eselect esd set 2 

if pulse audio is number 2.
gnome-volume-control
Code:

gnome-volume-control

select your input and output devices
gstreamer-properties
Code:

gstreamer-properties

select PulseAudio Sound Server

If system sounds like login and logout are not working you can test with;
Code:

esdplay /usr/share/sounds/login.wav


I had to add this to ~./bashrc
Code:

if [ ! -e /tmp/.esd-${UID} ]; then
    ln -s /tmp/.esd /tmp/.esd-${UID}
fi


KDE Setup
I contacted the KDE herd and it is as simple as;

KDE's phonon engine is using either media-libs/xine-lib or gstreamer as a
backend. You need to install either/both of them with pulseaudio USE flag
(media-libs/xine-lib is a default one).

In KDE all you need to do, is go to system-settings -> Multimedia, move
pulseaudio to the top of your list (the only annoying part is, that you need
to do it for each section - Notification, Music, Video, etc - as KDE can use
different audio outputs for everything). That's pretty much it.

Sound and Video Configuration

Important
plugdev dbus
Also either the pulse user needs to be in plugdev, or ;
pulseaudio needs to install a dbus policy file to allow access.
http://pulseaudio.org/ticket/582
audacity
I even have audacity working with dmix for output.
mplayer
I also edited /etc/mplayer/mplayer.conf
Code:

vo=gl
ao=alsa
fontconfig=1
subfont-osd-scale=4
subfont-text-scale=3
unrarexec=/usr/bin/unrar

I set up mplayer to use alsa and it is working so no need to change it to pulse at this time.
user mode vs system mode
This may help to explain user mode / system mode;
http://www.pulseaudio.org/wiki/WhatIsWrongWithSystemMode
Changlog
flameeyes is the expert on pulseaudio so I like to check his changelogs for insight :)
Code:

22 Jun 2009; Diego E. Pettenò  <flameeyes@gentoo.org>
-pulseaudio-0.9.15.ebuild, +pulseaudio-0.9.15-r1.ebuild,
+pulseaudio-0.9.15-r50.ebuild:
Resume with the doubled ebuild for pulseaudio: -r0 to -r49 will keep the
ebuilds without systemwide support, -r50 to -r99 will have it. The reason
for this is that the systemwide support requires OpenRC, which we won't
have stable anytime soon. Still, it requires libtool 2.2, so...

Guides I used
http://duckzland.ismywebsite.com/about/pulseaudio-and-gentoo/
http://pulseaudio.org/wiki/PerfectSetup
http://en.gentoo-wiki.com/wiki/PulseAudio
http://fedorasolved.org/Members/fenris02/pulseaudio-fixes-and-workarounds
http://ubuntuforums.org/showthread.php?t=789578

Tips
At this point in time it is known that the following ALSA sound drivers are broken in regards to "glitch-free" PA:
* Some snd-intel8x0 supported chips http://mailman.alsa-project.org/pipermail/alsa-devel/2009-February/014975.html #396 (Seems to be fixed by https://bugzilla.redhat.com/show_bug.cgi?id=472339)
* All newer Creative chips (snd-emu*) #435
* snd-intel-hda on some chips (seems to be fixed by https://bugzilla.redhat.com/show_bug.cgi?id=485734)
* Some snd-ice1712 supported chips #334
* snd-ens1371 http://mailman.alsa-project.org/pipermail/alsa-devel/2009-February/014929.html
* snd_es1938

Possible workarounds to make PA work on these chips are:

* Disabling glitch-free mode. I.e. pass tsched=0 to the alsa modules or module-hal-detect

/etc/pulse/default.pa
Code:

### Automatically load driver modules depending on the hardware available
.ifexists module-hal-detect.so
load-module module-hal-detect tsched=0
.else


When the PulseAudio ALSA plugins are active, you must explicitly specify your hardware device in alsamixer (marked in blue above), otherwise it will open the PulseAudio mixer.
My main soundcard
Code:

alsamixer -Dhw

My usb Microphone
Code:

alsamixer -Dhw:1

_________________
http://dev.gentoo.org/~dabbott/


Last edited by comprookie2000 on Mon Jan 04, 2010 1:13 am; edited 8 times in total
Back to top
View user's profile Send private message
casidiablo
n00b
n00b


Joined: 30 Dec 2008
Posts: 23
Location: Colombia

PostPosted: Fri Aug 28, 2009 2:28 am    Post subject: Reply with quote

Wow... this is so freaking great. I just installed PulseAudio some days ago; had I known about this great guide I'd have saved a bunch of time.

Even tough, I have saved this as favorite.

Thank you so much!
Back to top
View user's profile Send private message
ursusca
Apprentice
Apprentice


Joined: 10 Sep 2008
Posts: 284
Location: Toronto ON, CANADA

PostPosted: Wed Dec 02, 2009 8:59 pm    Post subject: Reply with quote

Hello comprookie2000,

Thanks for sharing it. I've installed pulseaudio today following your guide.
Everything seems to run fine but after typing "skype" in the terminal I got the following message
...
E: conf-parser.c: [/etc/pulse/client.conf:37] Unknown lvalue 'nice-level'.
E: shm.c: shm_open() failed: Permission denied
*** PULSEAUDIO: Unable to connect: Connection refused
E: conf-parser.c: [/etc/pulse/client.conf:38] Unknown lvalue 'no-cpu-limit'.
E: shm.c: shm_open() failed: Permission denied
...

I've commented all your recommendations from /etc/pulse/daemon.conf. After typing "skype" in the terminal I got the following message:
E: shm.c: shm_open() failed: Permission denied
*** PULSEAUDIO: Unable to connect: Connection refused
E: shm.c: shm_open() failed: Permission denied
*** PULSEAUDIO: Unable to connect: Connection refused
E: shm.c: shm_open() failed: Permission denied
*** PULSEAUDIO: Unable to connect: Connection refused
.....
My skype doesn't work properly now. I can't find "Pulse Audio Server" in skype's options.

Please help

Regards,
_________________
You deserve free software!
Back to top
View user's profile Send private message
comprookie2000
Developer
Developer


Joined: 25 Jul 2004
Posts: 905
Location: Pompano Beach, Florida

PostPosted: Wed Dec 02, 2009 9:13 pm    Post subject: Reply with quote

I don't use skype so can not be of much help, I hope something from The Perfect Setup #skype will help. Let us know how it goes and if you have any questions about what they are talking about, ask away. Good Luck with skype.
_________________
http://dev.gentoo.org/~dabbott/
Back to top
View user's profile Send private message
luispa
Guru
Guru


Joined: 17 Mar 2006
Posts: 351
Location: España

PostPosted: Sun Dec 13, 2009 11:11 am    Post subject: Reply with quote

Hi, I was using pulseaudio-0.9.15-r2 on a ~amd64 system, pretty stable. Yesterday I upgraded to 0.9.19 and sound is breaking. Have you updated recently to newer version?

Luis
Back to top
View user's profile Send private message
comprookie2000
Developer
Developer


Joined: 25 Jul 2004
Posts: 905
Location: Pompano Beach, Florida

PostPosted: Sun Dec 13, 2009 3:43 pm    Post subject: Reply with quote

Here is what I am currently using;
Code:

[ebuild   R   ] media-sound/pulseaudio-0.9.21-r50 
USE="X alsa asyncns avahi bluetooth caps dbus glib hal ipv6 tcpd udev
-doc -gnome -jack -libsamplerate -lirc (-oss) -test"

Still working pretty good, sometimes I have to run alsaconf after an emerge -uND world. I also have to run pavucontrol as a user sometimes if sound stops or does not sound perfect, but that seems to only happen when I am using a bunch of different sound applications or change usb sound devices. I use a couple different microphones and headsets. Make sure when you run paprefs as user there is nothing checked. I can not remember changing any of the configuration files. If you want to paste your config files, I like this way;
Code:

 wgetpaste -n dabbott -l Bash .asoundrc

Your paste can be seen here: http://dpaste.com/132782/

I can check them out. Let me know how you make out, I am trying to become more knowledgeable in the setting up of pulseaudio because once it becomes widely used there will be many people without sound because of the learning curve from straight alsa with or without esd or arts. Pulseaudio does seem to get better for me with each release, I have it working with everything including audacity now. Sometimes I do lose dmix, dmix is alsa's native mixer that I have to use with audacity. Sometimes when I go to edit a sound file and go to play it the clip will play super fast or stop. I then open audacity and the slider for dmix is gone. If I make sure I close all sound app's and restart audacity it will most times show back up. On a few occasions I have had to restart X. I think flash had messed it up but not sure. Flash plays super, I can play a couple flash videos at the same time if I wanted to, but I don't push my luck. Sound in Linux is still not where I would like it to be.
_________________
http://dev.gentoo.org/~dabbott/
Back to top
View user's profile Send private message
luispa
Guru
Guru


Joined: 17 Mar 2006
Posts: 351
Location: España

PostPosted: Sun Dec 13, 2009 7:44 pm    Post subject: Reply with quote

Thank you for your feedback. By the way, I moved to the latest too: 0.9.21-r50. My setup has been working nicely allways and started to fail just with the update to 0.9.19, and continued to fail with the latest 0.9.21-r50. System sounds, skype, vmware (workstation 7 w/alsa) all starting to play and inmediately stopping, like few miliseconds sounds...

I've this setup:

Code:
 audio card    ---\                             /------ native pulse apps
                   --- alsa/udev --- pulseaudio
 webcam w/ mic  --/     driver                  \------ alsa ----- native alsa apps


Then I either config apps to use ALSA or Pulse, and everything goes through pulseaudio (daemon run as user). I'm using Gnome.

Thank you for your comments, as knowing it "should" work is good :-). So, I've been testing a bit and I found the "tsched=0" in my config, which is something I added long ago due to issues I had. Just tested removing it, everything seems to work well again, but still testing.

See my changes (default.pa):
Code:
#load-module module-alsa-sink device=hw:0,0 sink_name=altavoces tsched=0
load-module module-alsa-sink device=hw:0,0 sink_name=altavoces


Running out of time now, but as soon as I finish the tests and confirm that's the issue I'll post more information, my config, etc.

Thanks again,

Luis
Back to top
View user's profile Send private message
luispa
Guru
Guru


Joined: 17 Mar 2006
Posts: 351
Location: España

PostPosted: Sun Dec 13, 2009 8:21 pm    Post subject: Reply with quote

Had some more time. Initial tests shows everything is back to normal.

What I did:
Quote:
- Recompiled everything that uses pulseaudio (no change, same issue)
- Removed "dsched=0" (this one solved the problem)


Setup:
Code:
 audio card    ---\                             /------ native pulse apps
                   --- alsa/udev --- pulseaudio
 webcam w/ mic  --/     driver                  \------ alsa ----- native alsa apps

- Main Audio: Intel Corporation 82801JI (ICH10 Family) HD Audio Controller
- Used for microphone: USB Logitech WebCam
- Used for TDT Capture: Cinergy HT PCI

Config Pulseaudio:
[*] /etc/pulse/default.pa. Static Configuration, DON'T use HAL, so I assign what I want in the order I want.
[*] /etc/pulse/daemon.conf
[*] I start the daemon from Gnome session with: /usr/bin/start-pulseaudio-x11

Config ALSA:
[*] /etc/modprobe.d/alsa.conf. Fixed cards numbers (same order allways)
[*] .asoundrc. Alsa plays through Pulseaudio

Then, I configure apps to play using Pulse or ALSA.

Luis
Back to top
View user's profile Send private message
luispa
Guru
Guru


Joined: 17 Mar 2006
Posts: 351
Location: España

PostPosted: Sun Dec 13, 2009 8:26 pm    Post subject: Reply with quote

comprookie2000 wrote:

Still working pretty good, sometimes I have to run alsaconf after an emerge -uND world. I also have to run pavucontrol as a user sometimes if sound stops or does not sound perfect, but that seems to only happen when I am using a bunch of different sound applications or change usb sound devices. I use a couple different microphones and headsets. Make sure when you run paprefs as user there is nothing checked. I can not remember changing any of the configuration files. If you want to paste your config files, I like this way;


Have you tried not using HAL?, I prefer to configure it manually so I get everything allways in the same place, take a look at my config.

Btw, Are you running pulseaudio daemon in system-wide mode?. Not in my case, and working pretty well, note that I'm using Gnome (not your case) and it re-launches it inmediately if process dies for whatever reason

Luis
Back to top
View user's profile Send private message
Dr.Willy
Guru
Guru


Joined: 15 Jul 2007
Posts: 352
Location: NRW, Germany

PostPosted: Mon Dec 14, 2009 7:59 pm    Post subject: Reply with quote

After reading this guide I got interested in PulseAudio and google'd a bit.
Ok. Now what I got is that it is kinda like ALSA or OSS exept different. There was one question however which I couldn't answer: Why would I want to install it? :P
I assume some PA users visit this thread, so I'd like to know: What awesome stuff can it do that others can't and what are its coolest features?
Enlighten me.
Back to top
View user's profile Send private message
luispa
Guru
Guru


Joined: 17 Mar 2006
Posts: 351
Location: España

PostPosted: Mon Dec 14, 2009 8:35 pm    Post subject: Reply with quote

Dr.Willy wrote:
Why would I want to install it? :P


Good question :-).
I decided to install it long ago. By the time I didn't know much about ALSA, Pulseaudio solved some problems, i.e. multiple sounds at the same time from different apps didn't work for me w/ ALSA.

However, after I made lots of tests trying to understand the whole options, I made a good ALSA setup and discovered that it works pretty well and indeed I wouldn't need PA for my setup.

I use it because I like my setup and it's already there working pretty well. Also like the GUI apps it offers and the fact that everything goes through it, so troubleshooting is easier (for me).

On the other hand, probably in a different case with the need for multiple features and complex configs I guess it offers much more functionality than ALSA, however I doubt the majority needs such setups, so w/ ALSA should be enough.

OSS is a no-go, in my opinion, not all apps support it and config/troubleshooting is more difficult (more low level).

My 2cent's: ALSA or Pulse for normal needs, and probably Pulse for "advanced" needs.

Luis
Back to top
View user's profile Send private message
Bircoph
Developer
Developer


Joined: 27 Jun 2008
Posts: 260
Location: Moscow

PostPosted: Tue Dec 15, 2009 11:50 am    Post subject: Reply with quote

Dr.Willy wrote:
Why would I want to install it?

I removed it completely from my system. ALSA is high configurable and sufficient for my needs, so I do not want an additional layer for my system. PulseAudio is not ALSA replacement, it is waste of CPU and memory resources for nothing.

As far as I understand the idea of PulseAudio, it tries to dynamically adjust sound levels of all applications running depending on what are you doing now. I do not need this, really. I do not use sound alerts in my instant messengers or mail clients, because I do not want them to interrupt my work when I do not need them, so nothing can interrupt my movie viewing.

And I really hate additional layers actually needed for nothing useful like pulseaudio, hal, consolekit. They are just eaters of your system resources and any program may be easy written without them.
_________________
Per aspera ad astra!
Back to top
View user's profile Send private message
HB2
n00b
n00b


Joined: 10 Aug 2005
Posts: 15
Location: Chile

PostPosted: Tue Dec 15, 2009 6:32 pm    Post subject: Reply with quote

Thanks ! :wink:
Back to top
View user's profile Send private message
Dr.Willy
Guru
Guru


Joined: 15 Jul 2007
Posts: 352
Location: NRW, Germany

PostPosted: Tue Dec 15, 2009 9:39 pm    Post subject: Reply with quote

that ... doesn't sound quite encouraging so far
Back to top
View user's profile Send private message
Mageta
n00b
n00b


Joined: 01 Nov 2007
Posts: 34
Location: germany

PostPosted: Thu Dec 31, 2009 4:44 am    Post subject: Reply with quote

Bircoph wrote:
Dr.Willy wrote:
Why would I want to install it?

I removed it completely from my system. ALSA is high configurable and sufficient for my needs, so I do not want an additional layer for my system. PulseAudio is not ALSA replacement, it is waste of CPU and memory resources for nothing.

As far as I understand the idea of PulseAudio, it tries to dynamically adjust sound levels of all applications running depending on what are you doing now. I do not need this, really. I do not use sound alerts in my instant messengers or mail clients, because I do not want them to interrupt my work when I do not need them, so nothing can interrupt my movie viewing.

And I really hate additional layers actually needed for nothing useful like pulseaudio, hal, consolekit. They are just eaters of your system resources and any program may be easy written without them.


Well, as long as your apps ONLY use native alsa (you activated the use flag and/or you configured them like this), there should rly be no reason to install pulse. On my old laptop I used to handle it like this.
With a new enough kernel and a good conf., even multiple apps could play their sound through alsa and everyone was happy (IF there were only apps who used alsa).
But.. if there is an evil app who still uses oss or esd or something ugly like this.. your whole alsa-setup is blown up. I never got this to work, alsa-apps + oss-apps at the same time (oh and it is easy to get this done. Once I wanted to play heroes3 with a friend and we both used teamspeak2. HA!.. games without sound are lame..). Theoretically this should work with pulse (I should test this sometimes).

But I agree with your opinion that all these additional layers are resource-killing monsters.

@Dr.Willy:
As far as I understood it.. all "old" and current sound-systems, like alsa, oss, esd,... provided devices within /dev/ (like /dev/dsp is/was provided by oss), with which your apps could speak, if they wanted to play something that you should hear (some sounds ;)). But while one app was playing something through one of these provided devices no other app could use it (the second app keeps silent). This is like it was in my case, with heroes3+teamspeak2.
With use of pulse, this should not happen anymore. All these devices in /dev/ keep existing and all the old apps can keep using their depreciated interfaces (like oss ;) ). BUT if an app connects to one of these devices the communication gets redirected to pulse and pulse tells the app "you can use me now and you can use me alone" but it handles the specific app in its own stream. Meanwhile other apps can do the same request on the same device and get also handled by pulse. All can play their sound, at the same time. Even "alsa-devices" can be handled like this (all new apps, which are alrdy using alsa natively).
That should be the main purpose for using some daemons like pulse. If you have no old software or you never use 2 sound playing application at the same time, you will never need pulse. It would be like hal on an pentium1-based system..

regards,
- mageta
Back to top
View user's profile Send private message
ursusca
Apprentice
Apprentice


Joined: 10 Sep 2008
Posts: 284
Location: Toronto ON, CANADA

PostPosted: Sun Feb 07, 2010 8:35 pm    Post subject: Reply with quote

comprookie2000 wrote:
I don't use skype so can not be of much help, I hope something from The Perfect Setup #skype will help. Let us know how it goes and if you have any questions about what they are talking about, ask away. Good Luck with skype.


Hi comprookie2000,
Thank you for attention to my question. net-im/skype 2.1.0.81 works fine. :)
_________________
You deserve free software!
Back to top
View user's profile Send private message
kiboko
n00b
n00b


Joined: 29 May 2003
Posts: 59

PostPosted: Wed Sep 14, 2011 8:29 pm    Post subject: Reply with quote

Great post! Helped me figure it all out.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum