It's time to solve my sound problems, which I have/had from the beginning.
I have 3 soundcards.

cat /proc/asound/cards
 0 [NVidia         ]: HDA-Intel - HDA NVidia
                      HDA NVidia at 0xdf080000 irq 17
 1 [CODEC          ]: USB-Audio - USB Audio CODEC
                      Burr-Brown from TI USB Audio CODEC at usb-0000:00:14.0-2, full speed
 2 [PCH            ]: HDA-Intel - HDA Intel PCH
                      HDA Intel PCH at 0xdf240000 irq 130
Now this order is wrong. And sometimes the order is right. But I don't know why the order is sometimes this and sometimes the other way round.
It actually never was this order before I didn't write /etc/modprobe.d/alsa-base.conf with
alias char-major-116 snd
alias snd-card-0 snd-hda-intel
alias snd-card-1 snd-hda-intel
alias snd-card-2 snd-hda-intel

options snd_hda_intel id=CODEC index=0
options snd_hda_intel id=NVidia index=1
options snd_hda_intel id=PCH index=2
before(without any config) sometimes PCH would be 0 and NVidia would be 2 and CODEC would be 1
and after some or one reboot this would "magically" change so that CODEC would be 0 (which are my speakers).
FOR NO APPARENT REASON lol wtf right?

Even the initialization process is weird. It's like a guy hammers twice from behind the speakers to see if there is something (no joke).

I followed this solution https://www.linuxquestions.org/questions/linux-hardware-18/wrong-sound-card-order-in-alsa-4175544059/

aplay -l gives
**** List of PLAYBACK Hardware Devices ****
card 0: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice # 0: subdevice # 0
card 0: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice # 0: subdevice # 0
card 0: NVidia [HDA NVidia], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice # 0: subdevice # 0
card 0: NVidia [HDA NVidia], device 9: HDMI 3 [HDMI 3]
  Subdevices: 1/1
  Subdevice # 0: subdevice # 0
card 1: CODEC [USB Audio CODEC], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice # 0: subdevice # 0
card 2: PCH [HDA Intel PCH], device 0: ALC892 Analog [ALC892 Analog]
  Subdevices: 1/1
  Subdevice # 0: subdevice # 0
in .asoundrc i have
defaults.pcm.card 0
defaults.ctl.card 0
Which shouldn't conflict as far as I am understanding. (and I wrote .asoundrc like 2 days ago)
There must be reason for all this

HELP! :)
strangely the above options worked once but not anymore, but I think I have found a clue why this is probably happening:
(form alsa.opensrc.com)
Module ordering problems
It may be that the sound card order is wrong after booting, but running (as root)

/etc/init.d/alsasound restart
or

/sbin/alsa force-reload
gives the wanted card order.

This can happen because udev is loading some sound driver before alsasound, and alsasound gets confused. A restart will first unload all the sound modules and when restarting, alsasound will work as expected.

The solution is to blacklist the module(s) that udev is loading before alsasound (Typically, the one you get as sound card 0 after booting). You must do this into

/etc/modprobe.d/blacklist.conf
You must also report it as a bug to your distribution.
Now we have eudev-obarun. Somehow the problem must lay in there i guess.

Also my alsa-base.conf is probably not correct defined. I need to have a look about the modul snd_usb_audio.

also
Problems with alsa.conf and udev
On modern GNU/Linux systems, udev takes care of discovering hardware and loading/unloading Alsa. There is one drawback to udev. Udev will load Alsa modules in an undefined order. After each reboot or plugging/unplugging a device, there is no guarantee that a device is renamed using the same hw:x,y numbers. For example, if you have two USB devices on your systems, for example an Audeon USB and an Edirol UA-25, after each reboot, a card can be "hw:0,0" and the other "hw:1,0", each time randomly.

/etc/init.d/alsasound is an udev wrapper that will take care of loading the ALSA modules during booting. But even with it, a few problems may still occur.
I guess eudev loads also in an undefined order? How can it be a distro bug then when it does this randomly? weird.
I have one sound card and I've had problems.
Have you used alsamixer? F6 sets the active card. hw0 hw1 ... etc.
I also use apulse to substitute for pulseaudio dependencies and it works.
Somewhere in /usr/lib there is a template .asoundrc that you can copy to your ~/

One thing I haven't been able to figure out is why my volume is being reset to about medium when I want it 100% so I can regulate it from the application, since I am not using panels and volumeicons.
Choosing a soundcard with alsamixer did nothing for me. I only could regulate the volumes but not switching. I'm using apulse for discord and it works perfectly. Put my mic is very quiet and I have to use a lot of gain. Also in alsamixer I only get one Volume controller, ignoring capture. I could imagine that is why my speakers get hit with a hammer on startup, because it wants to play and capture at the same time during initialization process and then it thinks it is one volume control. (my guess)

I tried this in /etc/modprobe.d/alsa-base.conf (name seems to be irrelevant as long there is .conf at the end)
options snd_usb_audio id=CODEC index=0
options snd_hda_intel id=PHC index=1
options snd_hda_intel id=NVidia index=2
Which worked sometimes but other times I got:
cannot find the slot for index 0 error: -16
usb 1-2: cannot create and instance 0
why this happens I don't know. I will now restart a few times and see if suddenly the approach fails.

I'm using the same approach like this guy
just put one line in /etc/modeprobe.d/alsa-base.conf
 
blacklist snd_hda_intel
Which ironically also solves the problem that certain games don't use the default index 0 device for sound :)
also didn't know that eric actually made pulseaudio packets for obarun:
obarun/pulseaudio-zeroconf 12.2-3 (3.4 KiB 4.0 KiB)
    Zeroconf support for PulseAudio
6 obarun/pulseaudio-s6serv 0.1-2 (14.3 KiB 58.0 KiB)
    pulseaudio service for s6
5 obarun/pulseaudio-lirc 12.2-3 (7.0 KiB 34.0 KiB)
    IR (lirc) support for PulseAudio
4 obarun/pulseaudio-jack 12.2-3 (16.3 KiB 90.0 KiB)
    Jack support for PulseAudio
3 obarun/pulseaudio-equalizer 12.2-3 (30.2 KiB 120.0 KiB)
    Equalizer for PulseAudio
2 obarun/pulseaudio-bluetooth 12.2-3 (52.8 KiB 217.0 KiB)
    Bluetooth support for PulseAudio
1 obarun/pulseaudio 12.2-3 (1.1 MiB 6.7 MiB)
    A featureful, general-purpose sound server
might be much more convenient.
  • [deleted]

Hello Nic

I have already in the past resolved this sound cards priority problem, perhaps I could help you.
But I don't understand what you expect as the final result. Could you be more specific about this?
jean-michel wroteHello Nic

I have already in the past resolved this sound cards priority problem, perhaps I could help you.
But I don't understand what you expect as the final result. Could you be more specific about this?
Hey Jean MIchel

Well, to be honest, I don't know what the problem is. I don't know which logs I have to take a look, so I see what is going on. But what basically happens is that my soundcards and the usb sound card get indexed sometimes in another way than it normally does.
So instead of putting the usb soundcard on 0 it would take the intel motherboard soundcard on 0.
But this happens not all the time, just sometimes. And as far as my understanding goes, this is because eudev does indexing the cards randomly.
The indexing problem I "solved" by blacklisting the kernel module snd_hda_intel, so my othersoundscards (motherboard and gpu one) don't even gets loaded. So my usb card is the only one and always at position 0. I'm fine with that.


Now the other problem I have is, that the initialization of my usb soundcard happens with a loud "boom" on my speakers and I only get one volume meter in alsamixer, but I can with apulse or adour use the mic on it. Which is weird as hell. If you could help me with that, would be highly appreciated.
  • [deleted]

Well, let's start from the beginning. We will see together what we can do.

Before we start, do you have others USB devices constantly connected on your computer other than USB audio card ? For example webcam, etc...
Next connect your USB audio cards and comment all your modifications made in "/etc/modprobe.d/" your blacklist file and perhaps more.

Now, some interesting commands line and I'm waiting for the output.

1) aplay -l

1b) aplay -L

2) cat /proc/asound/modules

3) lsmod

4) lsmod | grep snd

5) lsusb

6) ls /sys/module/snd

7) ls /proc/asound
External on usb I have constantly connected my Microsoft 360 gamepad (I'm having a problem there also, but I'm in contact with the developer of the game, I opened another thread under installation for that). But the problem didn't come up because I connected the gamepad. Also I have my mouse and keyboard connected via usb.

under /etc/modprobe.d/
there is only one entry
blacklist snd_hda_intel 
1)
**** List of PLAYBACK Hardware Devices ****
card 0: CODEC [USB Audio CODEC], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice # 0: subdevice # 0
1b)
null
    Discard all samples (playback) or generate zero samples (capture)
pulse
    PulseAudio Sound Server
default:CARD=CODEC
    USB Audio CODEC, USB Audio
    Default Audio Device
sysdefault:CARD=CODEC
    USB Audio CODEC, USB Audio
    Default Audio Device
front:CARD=CODEC,DEV=0
    USB Audio CODEC, USB Audio
    Front speakers
surround21:CARD=CODEC,DEV=0
    USB Audio CODEC, USB Audio
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=CODEC,DEV=0
    USB Audio CODEC, USB Audio
    4.0 Surround output to Front and Rear speakers
surround41:CARD=CODEC,DEV=0
    USB Audio CODEC, USB Audio
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=CODEC,DEV=0
    USB Audio CODEC, USB Audio
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=CODEC,DEV=0
    USB Audio CODEC, USB Audio
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=CODEC,DEV=0
    USB Audio CODEC, USB Audio
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=CODEC,DEV=0
    USB Audio CODEC, USB Audio
    IEC958 (S/PDIF) Digital Audio Output
2)
0 snd_usb_audio
3)
Module                  Size  Used by
cfg80211              782336  0
8021q                  36864  0
mrp                    20480  1 8021q
intel_rapl             24576  0
x86_pkg_temp_thermal    16384  0
intel_powerclamp       16384  0
coretemp               16384  0
kvm_intel             233472  0
snd_usb_audio         249856  0
snd_usbmidi_lib        32768  1 snd_usb_audio
kvm                   737280  1 kvm_intel
snd_hwdep              16384  1 snd_usb_audio
snd_rawmidi            36864  1 snd_usbmidi_lib
xpad                   36864  0
joydev                 24576  0
ff_memless             16384  1 xpad
snd_pcm               131072  1 snd_usb_audio
mousedev               24576  0
input_leds             16384  0
led_class              16384  2 input_leds,xpad
irqbypass              16384  1 kvm
crct10dif_pclmul       16384  0
crc32_pclmul           16384  0
ghash_clmulni_intel    16384  0
pcbc                   16384  0
iTCO_wdt               16384  0
mxm_wmi                16384  0
iTCO_vendor_support    16384  1 iTCO_wdt
intel_wmi_thunderbolt    16384  0
aesni_intel           200704  0
uas                    28672  0
aes_x86_64             20480  1 aesni_intel
crypto_simd            16384  1 aesni_intel
e1000e                282624  0
cryptd                 28672  3 crypto_simd,ghash_clmulni_intel,aesni_intel
usb_storage            69632  1 uas
glue_helper            16384  1 aesni_intel
intel_cstate           16384  0
intel_uncore          135168  0
intel_rapl_perf        16384  0
i2c_i801               32768  0
pcspkr                 16384  0
mei_me                 45056  0
mei                   106496  1 mei_me
wmi                    28672  2 intel_wmi_thunderbolt,mxm_wmi
evdev                  20480  26
mac_hid                16384  0
pcc_cpufreq            16384  0
snd_seq                81920  0
snd_seq_device         16384  2 snd_seq,snd_rawmidi
snd_timer              36864  2 snd_seq,snd_pcm
snd                    98304  8 snd_seq,snd_seq_device,snd_hwdep,snd_usb_audio,snd_usbmidi_lib,snd_timer,snd_pcm,snd_rawmidi
soundcore              16384  1 snd
vhost_vsock            20480  0
vmw_vsock_virtio_transport_common    32768  1 vhost_vsock
vsock                  40960  2 vmw_vsock_virtio_transport_common,vhost_vsock
vhost_net              24576  0
vhost                  49152  2 vhost_vsock,vhost_net
tap                    24576  1 vhost_net
uhid                   20480  0
hci_vhci               16384  0
bluetooth             638976  1 hci_vhci
ecdh_generic           24576  1 bluetooth
rfkill                 28672  2 bluetooth,cfg80211
userio                 16384  0
serio                  28672  1 userio
vfio_iommu_type1       28672  0
vfio                   32768  1 vfio_iommu_type1
dm_mod                155648  0
uinput                 20480  0
ppp_generic            45056  0
slhc                   16384  1 ppp_generic
tun                    45056  1 vhost_net
loop                   32768  0
btrfs                1376256  0
zstd_compress         184320  1 btrfs
libcrc32c              16384  1 btrfs
zstd_decompress        81920  1 btrfs
xxhash                 16384  2 zstd_compress,zstd_decompress
xor                    24576  1 btrfs
raid6_pq              122880  1 btrfs
cuse                   16384  0
fuse                  118784  1 cuse
ext4                  737280  4
crc32c_generic         16384  0
hid_generic            16384  0
crc16                  16384  2 bluetooth,ext4
mbcache                16384  1 ext4
usbhid                 57344  0
jbd2                  126976  1 ext4
hid                   139264  3 usbhid,hid_generic,uhid
fscrypto               32768  1 ext4
sd_mod                 61440  5
ahci                   40960  4
xhci_pci               16384  0
libahci                40960  1 ahci
xhci_hcd              266240  1 xhci_pci
libata                278528  2 libahci,ahci
crc32c_intel           24576  5
usbcore               294912  8 xhci_hcd,snd_usb_audio,usbhid,snd_usbmidi_lib,xpad,usb_storage,xhci_pci,uas
scsi_mod              258048  4 sd_mod,usb_storage,uas,libata
usb_common             16384  1 usbcore
nvidia_drm             45056  6
drm_kms_helper        200704  1 nvidia_drm
syscopyarea            16384  1 drm_kms_helper
sysfillrect            16384  1 drm_kms_helper
sysimgblt              16384  1 drm_kms_helper
fb_sys_fops            16384  1 drm_kms_helper
drm                   479232  9 drm_kms_helper,nvidia_drm
nvidia_uvm            917504  0
agpgart                49152  1 drm
nvidia_modeset       1093632  13 nvidia_drm
nvidia              14061568  516 nvidia_uvm,nvidia_modeset
ipmi_devintf           20480  0
ipmi_msghandler        65536  2 ipmi_devintf,nvidia
4)
 
snd_usb_audio         249856  0
snd_usbmidi_lib        32768  1 snd_usb_audio
snd_hwdep              16384  1 snd_usb_audio
snd_rawmidi            36864  1 snd_usbmidi_lib
snd_pcm               131072  1 snd_usb_audio
snd_seq                81920  0
snd_seq_device         16384  2 snd_seq,snd_rawmidi
snd_timer              36864  2 snd_seq,snd_pcm
snd                    98304  8 snd_seq,snd_seq_device,snd_hwdep,snd_usb_audio,snd_usbmidi_lib
snd_timer,snd_pcm,snd_rawmidi
soundcore              16384  1 snd
usbcore               294912  8 xhci_hcd,snd_usb_audio,usbhid,snd_usbmidi_lib,xpad,usb_storage,xhci_pci,uas
5)
Bus 002 Device 002: ID 05e3:0732 Genesys Logic, Inc. All-in-One Cardreader
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 045e:028e Microsoft Corp. Xbox360 Controller
Bus 001 Device 002: ID 08bb:2902 Texas Instruments PCM2902 Audio Codec
Bus 001 Device 005: ID 09da:fa44 A4Tech Co., Ltd.
Bus 001 Device 004: ID 09da:f6b7 A4Tech Co., Ltd.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
6)
holders/  parameters/  coresize  initstate  srcversion  uevent
notes/    sections/    initsize  refcnt     taint
7)
card0/  oss/  seq/  CODEC@   cards  devices  hwdep  modules  pcm  timers  version
  • [deleted]

Oups. I made a mistake the point number 6 in fact is > ls /sys/module/

It's a shame that you don't have commented the blacklist. Anyway.
We have two reordering methods.

1) First the old method with index.
nano -w /etc/modprobe.d/alsa.conf
# # ALSA # # 

# Max number of cards "optional" > in your case if I'm right that should be 3. 
options snd cards_limit=3

# Reordering
alias snd-card-0 snd-usb-audio
alias snd-card-1 snd-hda-intel
alias snd-card-2 snd-hda-intel
options snd-usb-audio index=0 vid=08bb pid=2902
options snd-hda-intel index=1,2 
Note: You can change the index order for snd-hda-intel according your needs.
Note: You can also add a vid and pid for your snd-hda-intel cards. You can find this info with lscpi -vvv command line. It's optionnal, that should work without it.

But if you want to give a try, It will look like that
options snd-hda-intel index=1,2 vid=<vid index-number-1>,<vid index-number-2> pid=<pid index-number-1>,<pid index-number-2>
2) Second the new method with slot
nano -w /etc/modprobe.d/alsa.conf
# # ALSA # # 

# Max number of cards "optional" > in your case if I'm right that should be 3.
options snd cards_limit=3

# Reordering
alias snd-card-0 snd-usb-audio
alias snd-card-1 snd-hda-intel
alias snd-card-2 snd-hda-intel
options snd-hda-intel index=1,2
options snd slots=snd-usb-audio,snd-hda-intel
Alternatively in this second method you can replace the line options snd slots=snd-usb-audio,snd-hda-intel by
options snd slots=,snd-hda-intel
Note: If the first or second method doesn't work well comment the lines:
# alias snd-card-1 snd-hda-intel
# alias snd-card-2 snd-hda-intel.
Note: In the second method if that doesn't work well, you can also comment the line:
# options snd-hda-intel index=1,2 
Well. I think it's good for a first try. Don't forget to remove your blacklisted cards module

PS: Have you installed the alsa-s6rcserv obarun binary package ?
It's a shame that you don't have commented the blacklist. Anyway.
I'm sorry I misunderstood you. My fault.

No I don't have alsa-s6rcserv installed, do I need that?
if so, do I need to just install it, or enable it somehow?

Maybe we start there, before I post again with the blacklisted modul commented.
$ pacman -S alsa-s6rcserv 

obarun/alsa-s6rcserv 0.2-1 [installed]
    alsa service for s6-rc
first you install it (small script)
Then you enable it, or make sure it is enabled
$ sudo s6opts enable bundle-Alsa           
:: bundle-Alsa already exist at /etc/s6-serv/enabled/classic, do you want to synchronize it [y|n]
y
:: Already enabled, do you want to send a ALARM signal to bundle-Alsa? [y|n]
y
  • [deleted]

Nic wrote
It's a shame that you don't have commented the blacklist. Anyway.
I'm sorry I misunderstood you. My fault.
No problem. It's my fault I was not clear.
Maybe we start there, before I post again with the blacklisted modul commented.
Install alsa-s6rcserv, comment your blacklist audio module and give a try with the code I send you above.
We will see if that work :)
I installed alsa-s6rcserv

but I can't enable it.
obarun@ spaceballz available % yay -Qs alsa-s6rcserv
local/alsa-s6rcserv 0.2-1
    alsa service for s6-rc


obarun@ spaceballz [1] ~ % sudo s6opts enable alsa-s6rcserv
[sudo] password for obarun:
:: alsa-s6rcserv does not exist, choose another one
obarun@ spaceballz [1] ~ % sudo s6opts enable bundle-Alsa
[sudo] password for obarun:
:: bundle-Alsa does not exist, choose another one
  • [deleted]

Execute sudo s6opts update bundle-Alsa to add bundle-Alsa at live database and the same command to delete bundle-Alsa from live database
obarun@ spaceballz ~ % sudo s6opts update bundle-Alsa
[sudo] password for obarun:
:: It's not allowed to use Default database
that is weird, because I remember I was doing:
# pacman -S acpid-s6serv
# s6opts enable acpid
a long time ago and that worked 0_0
wow Now I feel like I have to start from scratch T_T
  • [deleted]

Nic wrote
obarun@ spaceballz ~ % sudo s6opts update bundle-Alsa
[sudo] password for obarun:
:: It's not allowed to use Default database
Mmm!
That really weird because I just run it like that and that works. That why I was surprise when I run the command because I knew that it's not allowed to use Default database. It's even more strange because it's a new obarun installation and I have made no change on this side.

Eric, we need your help :)
I always end up with this weird stuff, I have a feeling it is because I used an old minimal image. I remember till I got internet working I needed like 5 days -.-

Powered by Obarun