Home | News | Download | Packages | Forum | Wiki | Github

Why no `pulseaudio-alsa` package? How else can PulseAudio work with ALSA?


#1

ALSA only works for me with a single program at a time, and only works when I have the audio user group, so I need to use PulseAudio with it or I can’t use audio except on one program. It doesn’t work for me when PulseAudio is enabled unless I’m in user group audio, but then it only uses pure ALSA. I looked around for a solution and the one only viable one I could find that I didn’t already try is is installing pulseaudio-alsa, only one problem, xbps does not have it…

Why does xbps not have pulseaudio-alsa alsa? Seems pretty important for sound. I probably can’t get PulseAudio to work without it. :frowning:


PulseAudio + ALSA, no sound, only plain ALSA produces sound
#2

There is:

alsa-plugins-pulseaudio

is that what you’re looking for?


#3

I’ve already installed that, it doesn’t work, are you sure it is the same thing as pulseaudio-alsa? (pulseaudio-alsa sounds like alsa support for pulseaudio while alsa-plugins-pulseaudio sounds like pulseaudio support for alsa)


#4

Pulseaudio uses alsa anyways, no other plugin needed.
https://wiki.voidlinux.eu/PulseAudio


(nf999) #5

I actually like it that I don’t have to install pulseaudio when I don’t need it :wink:

I fixed the issue above by adding a /etc/asound.conf. Not that trivial I agree, but my asound.conf as starter attached below. Works good enough. Probably better solutions exist, but this is simple and doesn’t require another thingy running. Note that I’m using a 2.1 surround setup, but the below conf works for 7.1 surround. I might still add a downmix route from 7.1 to 2.1 but since this is working nicely …

$ cat /etc/asound.conf
pcm.!default {
  type plug
  slave.pcm "dmixer"
}

pcm.dmixer {
  type dmix
  ipc_key 1024
  slave {
    pcm "hw:0,0"
    period_time 0
    period_size 1024
    buffer_size 8192
    channels 8
    # rate 44100
  }
  bindings {
    0 0
    1 1
    2 2
    3 3
    4 4
    5 5
    6 6
    7 7
  }
}

#6

If you only want to use ALSA put this in your /etc/asound.conf

defaults.pcm.card 0
defaults.ctl.card 0

Replace 0 with number of your active soundcard.
This will make programs use ALSA’s mixer, without a /etc/asound.conf or /home/user/.asoundrc programs will directly access your soundcard, which is why only one program at a time can play sound,.


(Erin) #7

The thing I am struggling with is using dmix for multiple audio, output to hdmi with a volume control. See to be able to do two of them but not all three!


#8

Two possible reasons for alsa only allowing one application to provide sound at a time:

  1. The right alsa plugins are not installed (Void doesn’t include them by default)
  2. Hardware mixing is broken and ALSA failed to detect it.

Number 2 is not common these days, but I did have it on my previous (ARM-based) laptop. I don’t think you need anywhere as much code as people are quoting here, I got away with only this.

Number 1 bugged me for a while. IIRC I also needed the 32 bit versions of the alsa libs/plugins, otherwise Wine applications would take exclusive control of the audio.

These are the alsa-related packages I currently have installed:

alsa-plugins alsa-plugins-pulseaudio alsa-tools alsa-utils alsa-lib-32bit alsa-plugins-32bit

Good luck.


(nf999) #9

for hdmi without volume use softvol, eg:

pcm.hdmi_headphones {
  type softvol
  slave.pcm "hw:1,3"
  control.name hdmi_volume
  control.card 1
}

Now you could start eg chromium with:

chromium --alsa-output-device="hdmi_headphones"

(haven’t found a way for firefox yet)


(nf999) #10

It could probably be easier, alsa is not that straight forward. The link you gave works, however is not using the 7.1 setup but just front and left, so dropping center and other speakers. This is hardly a big issue but for movies with 5.1 sound. There you miss large chunks like the center speaker etc.
For my specific setup I needed to adjust the sound to my speakers anyway, so I even had to add an alsa route. But I agree, for stereo the link you gave is probably sufficient. I ended up having a dmix and a custom downmix using route to make sure 7.1 sound ends up nicely in a 4.0 speaker setup.


(Erin) #11

Voila. The below worked for me. Output to HDMI with volume control and multiple concurrent sources.

softvol provides a volume control for HDMI.
dmix provides multiplexing - not exclusive use for a soundcard hardware.
hw specifics the non-default hardware, i.e. not 0,0.

   ctl.!default {
   type hw
   # set your default card 'play -L' to get list
   card 0
}

pcm.!default both

pcm.both	{
		type softvol
		slave	{
			pcm	{
				type plug
				slave	{
					pcm	{
						type dmix
						ipc_key 2589455
                       				ipc_perm 0666
                       						slave	{
							pcm	{
								type hw
								# your card
								card 0
								# your device
								device 3
								}
							}
						}
					}
				}
			}
		control	{
			# define volume control name
			name HDMI_Volume
			# set to your default card
			card 0
   			}
		}