You are not logged in.

#1 2016-07-03 18:40:07

darthdomo
Member
Registered: 2016-07-03
Posts: 2

Pulseaudio not finding ALC898 audio, works in ALSA

So, I'm tearing my hair out over this. I've gotten my arch install working fine, but I need to get pulseaudio working for my USB headset and for better configuration. I got the pulseaudio package installed along with pulseaudio-alsa, and I started the daemon with pulseaudio --start. When I open pulseaudio settings, I can see my Nvidia audio and my webcams microphone, but none of my Intel audio devices are working. Any help would be greatly appreciated.

Last edited by darthdomo (2016-07-03 18:50:32)

Offline

#2 2016-07-03 20:28:12

onslow77
Member
Registered: 2014-09-21
Posts: 279

Re: Pulseaudio not finding ALC898 audio, works in ALSA

Hello!

I suggest you read the following guides on the Arch wiki:
- Advanced Linux Sound Architecture/Troubleshooting
- PulseAudio/Troubleshooting

Regards
Martin


It is advised to follow the How to post guide when posting on the Arch forum. If one consciously jumps over these elementary steps like reading the wiki and providing necessary information about the problem, one can be regarded as a Help Vampire.

Offline

#3 2016-07-04 06:29:53

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,743

Re: Pulseaudio not finding ALC898 audio, works in ALSA

since you didn't mention a restart or similar, I'm going to assume that your card is occupied by a different application and hence pulse can't query information about it. Can you post

sudo fuser -v /dev/snd/*

Offline

#4 2016-07-08 10:26:29

marco_silva85
Member
Registered: 2012-06-13
Posts: 12

Re: Pulseaudio not finding ALC898 audio, works in ALSA

V1del,
the way you described the issue:

the card is occupied by a different application and hence pulse can't query information about it

describes a problem that I have and I didn't quite understood.

I start MPD (using ALSA) at boot with my server. Sometimes I log into a X11 desktop session just to use the browser, and pavucontrol doesn't list any Sound Cards in the Configuration tab, and "Output" tab shows "Dummy Output".
So, I stop / restart MPD and then pavucontrol lists everything correctly - the soundcard, the output, even MPD is shown there playing.

TLDR: I always have to manually restart mpd whenever I want to use a desktop session to have pulse audio.
Can you shed some light on this?

Offline

#5 2016-07-08 15:32:29

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,743

Re: Pulseaudio not finding ALC898 audio, works in ALSA

Sure:

ALSA by itself can only open a card in exclusive access mode (or rather only allow mixing if the card itself has a hardware mixer, which is basically none in this day and age), which means any application first requesting access to the card gets to use that card all by itself, which is good for that application since it can open the sounddevice with its preferred latency and sample rate requirements.  Somewhere down the line someone thought that this might not be so useful for general purpose environments, because one might e.g. want to listen to music while playing a game and not have one of them completely silent. Therefore dmix was implemented as a rudimentary software sound mixer. In the default (no other user-defined) configuration the ALSA 'default' device will point to your dmixed hw:0,0 audio card.  Somewhere down that line someone thought, hey what if we could expand on that and leverage more of the features ALSA technically has, but might be cumbersome to configure with its configuration files, and created pulseaudio.

Pulseaudio has a lot of useful, but not immediately obvious functionalities that the basic utilities ALSA has don't or can't provide or that aren't as easily accessible. In contrast to dmix, it is  capable of dynamically adjusting the needed latency and sample rate according to what is currently being played, move streams from device to device, provide volume meters to devices that don't natively have one (HDMI, SPDIF, Bluethooth, etc), session management (you can't listen to someone else's audio and vice versa, unless configured to allow so), quite a few additional capabilities beyond this scope (network transparancy etc.)

I digress a bit, but through all of that, the original notion still stands: ALSA will only allow one application at a time to access a soundcard. Therefore what happens is, pulseaudio starts and immediately grabs all soundcards it can find for itself, in order to provide the functionality it does. But obviously, if your soundcard is already occupied, pulseaudio can't grab the card either.

Now in your particular case with MPD, we have to take a look at the /etc/asound.conf provided by pulseaudio-alsa:

pcm.!default {
  type pulse
  fallback "sysdefault"
  hint {
    show on
    description "Default ALSA Output (currently PulseAudio Sound Server)"
  }
}

ctl.!default {
  type pulse
  fallback "sysdefault"
}

If we have an application that doesn't have native pulseaudio support but can use ALSA, the above configuration will use the ALSA pulse plugin to reroute the applications calls to pulseaudio. Since pulse provides most of ones needs in regards to mixing, there isn't much other configuration here other than that ALSA applications should be using pulseaudio. Still there is the fallback "sysdefault" line. Should, because pulse isn't running, loading of the module fail it will fall back to using the "sysdefault" device, which is unless configured, synonymous with "directly access hw:0,0".

Therefore if you start MPD as part of your startup routine and pulseaudio isn't running at that point in time, mpd will, via the fallback line go ahead and occupy hw:0,0.  When you log into your desktop session, pulseaudio gets started as part of that initialization routine. It will look for sound cards, it will find your sound card but attempting to open it will result in an error, since currently mpd is using it. Now as soon as you kill mpd, pulseaudio can go ahead and open it for itself. If you restart mpd now, loading of the ALSA pulse module won't fail (since pulse is running now) and MPD's sound stream will be available (albeit to denote that it's using the ALSA API, it's stream should be prefixed with [alsa-plugin] in pavucontrol). you can make MPD use pulseaudio directly and play nice with the rest of your setup without the need of a restart, but there are wiki pages for that.

If you use the command I mentioned in the previous post, this relation should become fairly apparent if you do it before killing mpd and after killing mpd. (Not on my arch, but you will see your soundcard being occupied by mpd, whereas it should be occupied by pulseaudio)

Offline

#6 2016-07-08 16:17:25

marco_silva85
Member
Registered: 2012-06-13
Posts: 12

Re: Pulseaudio not finding ALC898 audio, works in ALSA

Thank you for your very clear answer, reading some other threads I started to suspect something like what you explained was happening. You're clearly an audio GURU and indeed, fuser confirms it - MPD using the sound devices.

Now, I just found out that I don't have pulseaudio-alsa installed (and there isn't any /etc/asound.conf or .asoundrc) and MPD is configured with no default output (so it opens ALSA) - how come after restarting MPD, it starts routing the audio through pulseaudio (that just grabbed the Sound Device)? I suspect that if MPD can't open ALSA output, it opens it w/Pulse instead?

For me, I just need a solution for MPD to use pulseaudio (and that same pulseaudio to be the one used by the desktop session). I believe pulseaudio-alsa (asound.conf) will not be enough. I'll try when I get back home, wiki has some examples that I tried but not the exact one for this:
  MPD runs as mpd user, if it would call pulseaudio at boot (with the pulseaudio-alsa asound.conf) I guess PA server would run also as mpd user - and then when the desktop user launches, another pulseaudio server would be launched or would it try to access (failing) the PA server running as mpd user?

Offline

#7 2016-07-08 20:58:57

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,743

Re: Pulseaudio not finding ALC898 audio, works in ALSA

You got the gist of that, the  wiki mentions a few solutions, mpd can be configured to directly use pulseaudio (and likely this is what is happening if MPD isn't explicitly configured to do so, is that it first checks if pulse is running and if not falls back to ALSA, also define restarting mpd: Do you use the service file in both cases, or do you simply restart mpd so that it launches as your user instead?). The most hasslefree solution from what I gather is configuring mpd to run as your own user instead of as the mpd user so that it will start the pulseaudio server as intended as your own user and if you use systemd to autostart mpd, use a user service file instead of a global one.  I don't use mpd myself (yet, I should really get into that tongue ) so that's all the suggestion I can give on a whim.

We are derailing this thread a bit right now, so if you intend to try the mpd thing out and run into any problems it would be wise to open another thread about it (maybe linking back to this one as a reference) and use a descriptive title.  Chances are that if people are aware that a MPD problem is being discussed some with more specialized knowledge might pop in (Rasi comes to mind, he definitely uses mpd + pulse and knows a fair deal as  well)

@darthdomo sorry for the derail, I hope you get some useful insight out of this discussion, I kind of felt like writing a big post tongue

Offline

Board footer

Powered by FluxBB