Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How do ALSA and PulseAudio work?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
bzabc
n00b
n00b


Joined: 09 Sep 2012
Posts: 3

PostPosted: Sun Apr 14, 2013 12:09 pm    Post subject: How do ALSA and PulseAudio work? Reply with quote

hi,
i install pulseaudio according to the gentoo wiki (no "system-wide" USE), sound can be played :)
but i want to know how it is started?

$ mplayer2 test.mp3
$ ps aux | grep pulseaudio
........................................../usr/bin/pulseaudio --start --log-target=syslog

i don't have to manually start it (pulseaudio), how it is started?
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Sun Apr 14, 2013 12:32 pm    Post subject: Reply with quote

From a quick look at the alsa-plugins code, it calls pa_context_new (from alsa-plugins' pulse/conf_pulse.c and pulse/pulse.c), which would start up pulse, if I understand that terse documentation correctly.
_________________
Improve your font rendering and ALSA sound
Back to top
View user's profile Send private message
yngwin
Retired Dev
Retired Dev


Joined: 19 Dec 2002
Posts: 4572
Location: Suzhou, China

PostPosted: Sun Apr 14, 2013 2:25 pm    Post subject: Reply with quote

In my personal experience, pulseaudio more often than not, doesn't work.
_________________
"Those who deny freedom to others deserve it not for themselves." - Abraham Lincoln
Free Culture | Defective by Design | EFF
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1555
Location: Montréal

PostPosted: Sun Apr 14, 2013 4:00 pm    Post subject: Reply with quote

If you look at the output of
Code:
equery d pulseaudio

you will see which packages depends on Pulseaudio. Pulseaudio install a file pulseaudio.desktop in severals places like /etc/xdg/ausostart/pulseaudio.desktop. Xdg is a freedesktop.org standard I guess and more than one desktop environment depends on it. So it is start by default most of the time.

As a sound server, Pulseaudio take the control of the sound card. You can disable Pulseaudio with an appropriate /etc/asound.conf and give back the hand to Alsa and Dmix sound server. it can be disable to from Pulseaudio Volume Control (pavucontrol).

You can prevent Pulseaudio form being installed if you use the -pulseaudio USE flag in the make.conf USE variable.
_________________
Paul
Back to top
View user's profile Send private message
thens
n00b
n00b


Joined: 07 Apr 2012
Posts: 12

PostPosted: Fri Apr 19, 2013 7:02 pm    Post subject: Reply with quote

I had several problems with PA in the past as well, but nowadays everything works ootb.
Not sure what problems you guys still have with PA, would be interesting :wink:
Back to top
View user's profile Send private message
GFCCAE6xF
Apprentice
Apprentice


Joined: 06 Aug 2012
Posts: 295

PostPosted: Fri Apr 19, 2013 7:12 pm    Post subject: Reply with quote

thens wrote:
I had several problems with PA in the past as well, but nowadays everything works ootb.
Not sure what problems you guys still have with PA, would be interesting :wink:

Same here, it works great. Finally gave me something to replace the great control that OSSv4 and its mixer gave me.

Also I would like to echo what Logicien said.
Before I decided to try it out a while ago I was reading up beforehand, and after installing I was looking for information on some sort of service or daemon I may need to enable, I cant remember where it was I read it but it said that pulse gets started when it first needs to be (or even when x starts? (this could just be in my head though)) and if you try start it manually it will error telling you it has already been started, which is the case.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9645
Location: almost Mile High in the USA

PostPosted: Thu Apr 25, 2013 7:55 pm    Post subject: Reply with quote

I've also seen annoying issues with Pulseaudio. Really PA is the mixer in userspace, then PA will send audio off to ALSA in the kernel - which then sounds off.
The conflict is with the PA daemon and ALSA apps that don't deal with Pulseaudio.

If you have all your apps use PA then it should work fine, PA is nice - you can do a lot with individual streams - separate volume controls/mute per app outside the application's control, and redirecting audio to different speakers - including sending the stream over the internet...

But that's not a usage model I need (though the per-stream mute is really nice...), and using ALSA directly seems to work better, especially since apps like wine doesn't support PA properly (it seems to connect and disconnect from the audio device a lot, enough to confuse the pulseaudio daemon after a while.)

I do have PA working on some machines, mostly these machines do not run or infrequently run wine. Need make sure all apps can deal with pulse properly...

(and removing pulseaudio from my n900 is out of the question...)
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
VoidMage
Watchman
Watchman


Joined: 14 Oct 2006
Posts: 6196

PostPosted: Thu Apr 25, 2013 8:13 pm    Post subject: Reply with quote

eccerr0r wrote:
I do have PA working on some machines, mostly these machines do not run or infrequently run wine.


I've been wondering about this for quite awhile.
I haven't been using wine much, but while I do recall some major problems between its alsa driver and pulseaudio, I haven't noticed those noticed those in quite awhile (about a year at least, IIRC). Is it a matter of me not using wine much, having an odd (very old) hardware setup, or perhaps something else ?
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9645
Location: almost Mile High in the USA

PostPosted: Thu Apr 25, 2013 8:20 pm    Post subject: Reply with quote

I admit that I think I've been PA-free on my wine machine for about that long so I don't know :D
I'll have to wine around my remaining PA machines ... maybe they did finally fix it (one or the other...)
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
simon_irl
Guru
Guru


Joined: 07 Oct 2004
Posts: 403
Location: New Zealand

PostPosted: Thu Apr 25, 2013 9:32 pm    Post subject: Reply with quote

thens wrote:
I had several problems with PA in the past as well, but nowadays everything works ootb.
Not sure what problems you guys still have with PA, would be interesting :wink:

the problem i have with it is roughly the same problem i'd have with a pair of mechanical cutlery-holders for working my knife and fork. alsa works nicely on all my systems, including those with multiple soundcards etc...why on earth would i want to install a bunch of other stuff to complicate things and waste resources and add to the list of stuff to troubleshoot if audio stops working? i'm sure it does amazing, valuable things for the (more and more) people who are using it...but for me, i've never noticed any practical advantage (i.e. i use my audio apps exactly the same way whether they're sitting on pulseaudio or alsa), so pure alsa sucks less.
Back to top
View user's profile Send private message
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1480

PostPosted: Thu Apr 25, 2013 10:05 pm    Post subject: Reply with quote

If you want PA
most likely because
you have problems with alsa.
To solve your issues most likely you have
played a while with different configurations in asound.conf.
Alsa sound is restored by openrc on every boot. Might not be easy to get rid of ...
Back to top
View user's profile Send private message
salahx
Guru
Guru


Joined: 12 Mar 2005
Posts: 530

PostPosted: Fri Apr 26, 2013 8:16 am    Post subject: Reply with quote

PulseAudio itself is a D-Bus service, so it can be activated via d-bus service activation as well (you can deactivate the auto-activation if desired). Note that PulseAudio is a session (user) service, not a system one.

PulseAudio users can see it with:
Code:
dbus-send --session --dest=org.freedesktop.DBus --print-reply /org/freedesktop/DBus org.freedesktop.DBus.ListName


There is an PulseAudio plugin for ALSA as well, thus it is possible (even recommended) to create an ALSA "pulse" virtual device. Legacy ALSA-only (in particular, Wine) applications then get routed to PulseAudio (activating the service as above) - which ultimately routes it back to ALSA again.

If you use the above setup PulseAudio should "just work".
Back to top
View user's profile Send private message
rickj
Guru
Guru


Joined: 06 Feb 2003
Posts: 427
Location: Calgary, Alberta, Canada

PostPosted: Wed Jun 12, 2013 5:52 pm    Post subject: Reply with quote

Pulseaudio does not "just work" for me

I came by pulseaudio because it became a default, and was installed on an update. It does not seem to offer anything positive for me.

Regrettably it has taken over the sound cards in alsa with a virtual "Pulseaudio" card. This means the settings on the real card are not saved on shutdown. As a result, after each reboot, I have to enter alsamixer, press f6, select the real card, unmute it, and raise its volume.

Is there any way to configure things so that the settings of the real card are saved, as previously was the case?
Back to top
View user's profile Send private message
666threesixes666
Veteran
Veteran


Joined: 31 May 2011
Posts: 1248
Location: 42.68n 85.41w

PostPosted: Wed Jun 12, 2013 6:17 pm    Post subject: Reply with quote

pulse audio is a gem on my system i love it :twisted:

once the devs put xfce4-volumed-pulse in portage for me that is.... i had problems with unmuting hidden channels. dont build gnome-media with pulseaudio use flag or you'll lose your mixer in the systray
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Wed Jun 12, 2013 7:10 pm    Post subject: Reply with quote

rickj wrote:
Is there any way to configure things so that the settings of the real card are saved, as previously was the case?

Manually edit the media-sound/pulseaudio ebuild to remove the forced dependency on alsa-plugins[pulseaudio], then reinstall the latter with that use flag disabled. Doing so removes the config files that make the virtual pulseaudio sound card take over your system.

There are no other negative side-effects to doing this, it's purely a GnomeOS "we know better than you" thing from upstream.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9645
Location: almost Mile High in the USA

PostPosted: Fri Jun 14, 2013 4:22 pm    Post subject: Reply with quote

Pulseaudio snuck back up on me on my x86-64 install. I had PA installed because I had forgotten about the USE=-pulseaudio flag while reinstalling over my x86 (32-bit) install. But surprisingly, it actually seems to work allright on this recent install - with wine-1.5.?? (with its non-Wine supported PulseAudio patch.)

The same caveat still exists: all PA aware or die in a flaming pile of <skip><beep><hiss><skip><silence>...
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Sat Jun 15, 2013 1:24 am    Post subject: Reply with quote

To be fair I should add that PA works great on one of my systems; the one with a real hardware-mixing sound card, where it serves no actual purpose other than as a hack to avoid a desync bug in ffmpeg.
Back to top
View user's profile Send private message
666threesixes666
Veteran
Veteran


Joined: 31 May 2011
Posts: 1248
Location: 42.68n 85.41w

PostPosted: Sat Jun 15, 2013 6:44 am    Post subject: Reply with quote

eccerr0r, i had those problems before pulse 3, and 4... that is to say me too :lol:
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9645
Location: almost Mile High in the USA

PostPosted: Sun Jun 16, 2013 12:30 am    Post subject: Reply with quote

The machine that was borked in x86 and now seemingly working in x86-64 is an Intel HDA chipset audio (Gigabyte EP43-UD3H), oddly enough. And another thing that seems to have started working correctly was suspend/resume with recent kernels. I am quite shocked (at least the machine has been able to not crash after eleven S3 suspend/resume cycles so far). Perhaps it's the 64-bit kernel and 32 is just broken... Alas that's off topic...

I don't have any machines with high end audio codecs...
Back to top
View user's profile Send private message
666threesixes666
Veteran
Veteran


Joined: 31 May 2011
Posts: 1248
Location: 42.68n 85.41w

PostPosted: Sun Jun 16, 2013 12:57 am    Post subject: Reply with quote

"How do ALSA and PulseAudio work?" ok you asked for it... electricity... and magnets... and woofer cones.... and linux kernels.... and sound cards... i wish i knew how pulse audio worked, and where settings were to set things like buffers and latency. as far as i know its automatically determined by gnome, probably somewhere deep in the gconf editor.

i remember this being a very useful resource when i was linux from scratching over 4 years ago.... http://www.alsa-project.org/main/index.php/Documentation if you find the pulse audio version of that site, link me please lol id like to know pulse in depth like that.
Back to top
View user's profile Send private message
dark-wulf
n00b
n00b


Joined: 02 Feb 2006
Posts: 40

PostPosted: Mon Jun 17, 2013 8:55 pm    Post subject: Reply with quote

sorry if i am wrong but is pulse not just an audio server and still depends on alsa drivers?
And yes and i don't like PA ;-) only trouble....
_________________
Gentoo rulez!!!
Gentoo for every one!!!
Gentoo for president!!!
Back to top
View user's profile Send private message
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1480

PostPosted: Mon Jun 17, 2013 11:58 pm    Post subject: Reply with quote

Quote:
And yes and i don't like PA ;-) only trouble....
The most of the herd comes in when they misconfigured their alsa already. Which is why pulseaudio has problems then ...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia 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