Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: SOLVED: Alsa re-initialization (Read 401 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

SOLVED: Alsa re-initialization

I purchased a new mini-pc (TRIGKEY 8 Core 16 Thread Ryzen 7 Mini PC Desktop PC S5 5700U). To avoid an initial setup process I cloned my intel nuc nvme and swapped out the windows 11 contaminated smaller nvme. 

The installed artix nvme booted and after a bit of messing about I was able to get slim+openbox working.

I am having trouble making sound work. Somehow I have a persisting setup for  a PCH sound card as default. I cannot find the place where that is set.

I removed ~/.asoundrc, and there is no /var/lib/alsa/asound.state, I checked in /usr/share/alsa /etc/alsa but could not find the PCH.

Is there any way to reset alsa to a clean state. Can I re-install all alsa packages?

I can see that there are 3 cards in /proc/alsa and can use aplay -l to list them and also alsamixer -c <card> seems to work, but the default PCH seems to mess everything up.

Edit: I started alsa-runit and after a reboot I see that the PCH error has gone. I then had to create /etc/asound.conf and put in the correct card number ie  
Code: [Select]
defaults.pcm.card 1
defaults.ctl.card 1

Re: SOLVED: Alsa re-initialization

Reply #1
Hello,

I have been using alsa only for several years.
I removed all pulse packets except libpulse and libcanberra.

I use alsa and the nice and very practical qastools mixer on different pc:
https://forum.artixlinux.org/index.php/topic,4318.msg27848.html#msg27848

Note: I don't play games and don't use wine or steam.
But I have sound in all my apps.

###########

I want my two HDA-Intel cards to always be in position 0 and 1 and my USB-Audio card to be in position 2 :


To see the names of loaded modules:
Code: [Select]
cat /proc/asound/modules
  0 snd_hda_intel
  1 snd_hda_intel
  2 snd_usb_audio


To set position 2 of snd_usb_audio in all cases:
Code: [Select]
sudo nano /etc/modprobe.d/alsa-base.conf


I put this in there:
Code: [Select]
options snd_usb_audio index=2


*****

To see the cards and their numbers:

Code: [Select]
cat /proc/asound/cards
  0 [HDMI]: HDA-Intel - HDA ATI HDMI
                       HDA ATI HDMI at 0xfce60000 irq 96
  1 [Generic ]: HDA-Intel - HD-Audio Generic
                       HD-Audio Generic at 0xfc900000 irq 98
  2 [Camera]: USB-Audio - USB 2.0 Camera

Re: SOLVED: Alsa re-initialization

Reply #2
Thanks tintin, good to know how you did it. Personally i try to avoid guessing what I need to do with the modules and try to understand the alsa names/car numbers.

On my new amd mini-pc I find the non-hdmi sound device doesn't have a beep device. So I have to create a special beep command etc etc using a script eg

Code: [Select]
#!/bin/sh
#sudo modprobe pcspkr
#beep "$@"
#sudo modprobe -r pcspkr
play -q -n synth 0.1 sin 440 vol 0.15 &>/dev/null

Also I set up the machine using a per machine script eg
Code: [Select]
#rely on ALSA store/restore 
export ALSA_SPKR_CARD_NUM=1
export ALSA_SPKR_CHANNEL='Master'
export BASE_COLOR='#214323'

then can use initialization likeamixer -c${ALSA_SPKR_CARD_NUM:-0} sset "${ALSA_SPKR_CHANNEL:-Master}" ${ALSA_SPKR_VOLUME:-95%} unmute


I used amixer -c1 scontrols to find the control names.