The ALSA module name conundrum

Hello, this may be better off on a Debian or ALSA related board. But as it appears something that the ALSA guide says I need is not available on my DietPi installation, I’m coming here to see if anyone can help me past my one roadblock.

The short question is,

How do I figure out the correct “snd_*” style module name of all three of my “soundcards”? I need them to put into the file that fixes the soundcard order. I only can figure out two of them.

Details:

I setup gmrender-resurrect on a NanoPi NEO2 to act as a USB streamer. The only way I was able to get sound sent to my USB DACs was … I figured out I needed to use the following as the identifier startup parameters to the binary gmediarender:

--gstout-audiosink=alsasink --gstout-audiodevice="plughw:2,0"

Where, my sound card list is the following:

root@NanoPi_NEO2:~/gmrender-resurrect/dist-scripts/debian# cat /proc/asound/cards
 0 [Codec          ]: H3_Audio_Codec - H3 Audio Codec
                      H3 Audio Codec
 1 [allwinnerhdmi  ]: allwinner_hdmi - allwinner,hdmi
                      allwinner,hdmi
 2 [Audio          ]: USB-Audio - m9XX USB Audio
                      Grace Design m9XX USB Audio at usb-1c1d000.usb-1, high speed

The problems are …

A. I have not figured out a better way to name the Audio Device parameter than “plughw:2,0”. I really want “usb-dac”. But that does not work. No name I tried but this has worked. Maybe someone knows about “gmediarender” and alias names for gstout-audiodevice that work. That would render everything below moot.

But assuming I need to use that identifier…

B. On boot, sometimes my connected DAC index changes (and it will not always be the m9XX; hot swapping different DACs does work, I have done it successfully. but that is besides the point, except that I don’t want to tie my reference name to any spcific DAC name.) This throws a wrench in streaming to the DAC. I have to keep rebooting until the order of configured soundcards returns to this, or ssh to the device and change the parameter to plughw:1,0 or plughw:0,0, and restart the service.

So turning to the ALSO usage instructions/guide, that describes how to force/specify the sound card order.

if your sound card order changes on boot, you can specify their order in any file ending with .conf in /etc/modprobe.d (/etc/modprobe.d/alsa-base.conf is suggested). For example, if you want your mia sound card to be #0:

/etc/modprobe.d/alsa-base.conf:

options snd_mia index=0
options snd_hda_intel index=1

>
> Use $ cat /proc/asound/modules to get the loaded sound modules and their order. This list is usually all that is needed for the loading order. Use $ lsmod | grep snd to get a devices & modules list. This configuration assumes you have one mia sound card using snd_mia and one (e.g. onboard) card using snd_hda_intel.

C. BUT, NEXT PROBLEM ... the file "/proc/asound/modules" does not exist on this distribution.  :frowning:

D. Based on the following command, I can only figure out two of the correct "snd_*" identifiers.  Those being snd_usb_audio and snd_soc_simple_card.

```text
root@NanoPi_NEO2:/etc/modprobe.d# lsmod  | grep snd_
snd_usb_audio         151552  0
snd_hwdep              20480  1 snd_usb_audio
snd_usbmidi_lib        28672  1 snd_usb_audio
snd_rawmidi            28672  1 snd_usbmidi_lib
snd_seq_device         16384  1 snd_rawmidi
snd_soc_simple_card    16384  0
snd_soc_simple_card_utils    16384  1 snd_soc_simple_card

E. As we see way above “cat /proc/asound/cards” (and the alsamixer UI) enumerate three sound cards. But “lsmod” only notes two base cards. And there is no “/proc/asound/modules” file generated. …

So, How do I figure out the correct three snd_* identifier names I need to use in the file /etc/modprobe.d/alsa-base.conf that I need to create to fix the soundcard index order? Right now I have the following. I need the correct identifier to put at index 0 for the Codec:

options snd_ index=0
options snd_snd_soc_simple_card index=1
options snd_usb_audio index=2

Much thanx for all informed replies!

Did I perhaps find the answer? I’ll try it out to see if this works and not break ALSA. But… Is the problem that I was assuming I needed an identifier that starts with snd_ ? (as all examples I’ve seen do that). Given this…

root@NanoPi_NEO2:/etc/modprobe.d# cat  /lib/modules/4.14.0/modules.order  | grep snd-
kernel/sound/core/snd-hwdep.ko
kernel/sound/core/snd-seq-device.ko
kernel/sound/core/snd-rawmidi.ko
kernel/sound/core/seq/snd-seq.ko
kernel/sound/core/seq/snd-seq-midi.ko
kernel/sound/core/seq/snd-seq-midi-event.ko
kernel/sound/drivers/snd-dummy.ko
kernel/sound/drivers/snd-aloop.ko
kernel/sound/usb/snd-usb-audio.ko
kernel/sound/usb/snd-usbmidi-lib.ko
kernel/sound/soc/codecs/snd-soc-spdif-rx.ko
kernel/sound/soc/codecs/snd-soc-spdif-tx.ko
kernel/sound/soc/generic/snd-soc-simple-card-utils.ko
kernel/sound/soc/generic/snd-soc-simple-card.ko
kernel/sound/soc/generic/snd-soc-simple-scu-card.ko

… I’m guessing the correct identifier would be “ir_lirc_codec” given the following? …

root@NanoPi_NEO2:/etc/modprobe.d# cat  /lib/modules/4.14.0/modules.order  | grep codec
kernel/drivers/media/rc/ir-lirc-codec.ko
kernel/sound/soc/codecs/snd-soc-spdif-rx.ko
kernel/sound/soc/codecs/snd-soc-spdif-tx.ko

? What do you think? Thanx!