Taylorbyte.com

Documentation Wiki

Migrate to pulseaudio with multiseat

How to migrate to pulseaudio

Back up the old alsa configuration

mv /etc/asound.conf /etc/asound.conf.old

Pulse does not need a /etc/asound.conf file to work.

Install PulseAudio

pacman -S pulseaudio pavucontrol

For multiseat users

The following configuration assumes you have 2 sound cards, with 2 seats.

Pulseaudio needs exclusive access to the soundcard, so the other user will not be able to play sound on your "side". The Alsa/Dmix way here (scroll down to the sound section) allows everyone to use all sound cards.

If you have more sound cards, make more /etc/pulse/default-hw*.pa files and change the load alsa-module-(sink|source) device=hw:(number here) line.

The actual soundcard mapping is done in the final script

Create new /etc/pulse/default.pa pulseaudio config files

cp /etc/pulse/default.pa /etc/pulse/default-hw0.pa
cp /etc/pulse/default.pa /etc/pulse/default-hw1.pa

Edit /etc/pulse/default-hw0.pa

sed -i 's/^load-module module-udev-detect/#&/g' /etc/pulse/default-hw0.pa
sed -i 's/^load-module module-detect/#&/g' /etc/pulse/default-hw0.pa
sed -i 's/#\(load-module module-alsa-sink\)/\1 device=hw:0/g' /etc/pulse/default-hw0.pa
sed -i 's/#\(load-module module-alsa-source\).*/\1 device=hw:0/g' /etc/pulse/default-hw0.pa
sed -i 's/^load-module module-role-cork/#&/g' /etc/pulse/default-hw0.pa

Edit /etc/pulse/default-hw1.pa

sed -i 's/^load-module module-udev-detect/#&/g' /etc/pulse/default-hw1.pa
sed -i 's/^load-module module-detect/#&/g' /etc/pulse/default-hw1.pa
sed -i 's/#\(load-module module-alsa-sink\)/\1 device=hw:1/g' /etc/pulse/default-hw1.pa
sed -i 's/#\(load-module module-alsa-source\).*/\1 device=hw:1/g' /etc/pulse/default-hw1.pa
sed -i 's/^load-module module-role-cork/#&/g' /etc/pulse/default-hw1.pa

Create /etc/X11/xinit/xinitrc.d/50-multiseat-audio

cat > /etc/X11/xinit/xinitrc.d/50-multiseat-audio << EOF
rm /tmp/pulse-default-\`whoami\`.pa > /dev/null 2>&1
if [ "\`echo \$DISPLAY\`" = ":0" ]; then
  ln -s /etc/pulse/default-hw0.pa /tmp/pulse-default-\`whoami\`.pa
fi
if [ "\`echo \$DISPLAY\`" = ":1" ]; then
  ln -s /etc/pulse/default-hw1.pa /tmp/pulse-default-\`whoami\`.pa
fi
if [ ! -e ~/.pulse/default.pa ]; then
  ln -s /tmp/pulse-default-\`whoami\`.pa ~/.pulse/default.pa
fi
EOF
chmod +x /etc/X11/xinit/xinitrc.d/50-multiseat-audio

NB: You may have to install lib32-libpulse if you use skype or 32 programs.

If videos are out of sync try this:

edit /etc/pulse/daemon.conf and uncomment the following 2 line

default-fragments = 4
default-fragment-size-msec = 25