Skip to content

Instantly share code, notes, and snippets.

@xmawja
Last active October 2, 2025 10:20
Show Gist options
  • Select an option

  • Save xmawja/1f5d872b2d9a79f91b203a3999b652a6 to your computer and use it in GitHub Desktop.

Select an option

Save xmawja/1f5d872b2d9a79f91b203a3999b652a6 to your computer and use it in GitHub Desktop.
Setting the default device sound card alsa/pulsausio/pipewire on gnu/linux
## check available sound card that attached to your system.
# cat /proc/asound/cards
## or better check card name to use insted of card number.
# cat /sys/class/sound/card*/id
## guide https://wiki.gentoo.org/wiki/ALSA#.7E.2F.asoundrc
# verification used driver
LANG=C pactl info | grep "Server Name"
# add user to audio group
gpasswd -a xmawja audio
## Setting the default device
## change th number 0 to your sound card show from command above
defaults.pcm.card 0
defaults.ctl.card 0
## set the default sound card
## change th number 0 to your sound card show from command above
pcm.!default {
type hw
card 0
}
ctl.!default {
type hw
card 0
}
## create /etc/asound.conf file if not exist and replace it with this file.
## set volume control using terminal
# alsa
#amixer set 'Master' 10%+
# pipewire
#amixer -D pipewire sset Master 100%
# paulsaudio
#pactl -- set-sink-volume 0 +10%
# if using pipewire dont forget to copy configuration files
# cp /usr/share/pipewire/* /etc/pipewire/
# for gentoo users migration article
# https://www.gentoo.org/support/news-items/2022-07-29-pipewire-sound-server.html
# for archlinux users you must enable /etc/modprobe.d/alsa-base.conf and
################
# work well with gentoo pipewire
defaults.pcm.!card 0
defaults.pcm.!device 0
#defaults.pcm.card 2
#defaults.ctl.card 2
## set the default sound card
## change th number 0 to your sound card show from command above
pcm.!default {
type hw
card 2
device 0
}
ctl.!default {
type hw
card 2
device 0
}
# TROBLESOTING: check driver in use
aplay -l
lspci | grep -i audio
dmesg | grep -i snd
# copy to /etc/modprobe.d/alsa-base.conf
options snd_usb_audio index=0
options snd_bcm2835 index=1
options snd_alc892 index=2
# if some how dosn't work change it with this
# error : cannot find the slot for index 0
options snd-usb-audio index=0,1
options snd-hda-intel index=2,3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment