1

I have a new docking station for my laptop and have a hard time configuring audio/alsa.

After checking cat /proc/asound/cards

 0 [PCH            ]: HDA-Intel - HDA Intel PCH
                      HDA Intel PCH at 0xec248000 irq 158
 1 [Audio          ]: USB-Audio - ThinkPad Dock USB Audio
                      Generic ThinkPad Dock USB Audio at usb-0000:3c:00.0-1.4.4, high speed

I created /etc/asound.conf like this

pcm.!default {
    type hw
    card 1
}

ctl.!default {
    type hw           
    card 1
}

This seems to be working for most applications (Chromium, VLC, mpd, etc.) but I have no audio output in Firefox and I don't have audio output on multiple applications (parallel?) at the same time (ex: If I start Chromium I have no audio in VLC).

VLC gives me this error message for example:

Audio output failed:
The audio device "default" could not be used:
Device or resource busy.
  • How do I make it works for multiple applications at the same time?
  • Is there something specific to do for Firefox ?
  • How to fallback to card0 (laptop) if card1 (docking station) is not plugged in?

ty

Resources:

Installed packages:

alsa-utils, alsa-firmware, sof-firmware

uname -a:

Linux T480s 6.7.4-arch1-1 #1 SMP PREEMPT_DYNAMIC Mon, 05 Feb 2024 22:07:49 +0000 x86_64 GNU/Linux

Edit: multiple audio output and Firefox audio are working fine with card0 (internal)

Edit2:

Following https://wiki.archlinux.org/title/Advanced_Linux_Sound_Architecture#Configuring_the_index_order_via_kernel_module_options I changed the index order of the cards in /etc/modprobe.d/alsa-base.conf :

options snd_usb_audio index=0
options snd_hda_intel index=1

I removed /etc/asound.conf and rebooted.

When snd_usb_audio is loaded as the default card (card0) it is working. Firefox audio is working fine and I can output audio in multiple application at the same time.

So this means I only need to load snd_usb_audio as card0 if plugged and fallback to snd_hda_intel if not. Can we do this in alsa-base.conf or /etc/asound.conf?

9
  • What's your desktop environment (Gnome, XFCE, KDE, …) ? Usually, when your DE start, it brings up a sound daemon that takes care of that – and also arranges for mixing of sound coming from multiple applications (which kind of can't work if you directly assign the sound card to a single application). Not having sound in one application while another one uses sound is a bit too 1990 for my taste… Commented Feb 16 at 16:16
  • I3 but audio from multiple applications is working fine with card0 so I don't think it's relevant?
    – grrr
    Commented Feb 16 at 16:20
  • might be a matter of hardware channels, I don't know, to be honest! Commented Feb 16 at 16:22
  • re: I3: I use a similar window manager, but a WM is not a DE; do you manually start pipewire, or which component does that? Commented Feb 16 at 16:29
  • 1
    yeah well then you need to do this all on your own, and the behaviour you see is expected. Add a dmix ALSA pseudo-device, use that in your applications. (also, don't do this to yourself, use pipewire.) Commented Feb 16 at 16:50

1 Answer 1

0

<kidding>"grrr ? I am with you on that one, my friend !</kidding>


Treating your questions in some disorder :

I have no audio output in Firefox

Since… pffff… I cannot remember and for whatever somber reason, firefox decided to support a single audio backend : pulseaudio.
The only way to follow if you want to output directly to alsa (or other sound server) is… to build it from sources since it still offers some configure options enabling that.

Device or resource busy.

Nothing but normal considering your definitions for pcm.!default
The first application using it will immediately block the device for its own and exclusive use hence preventing any other to proceed concurrently.
In order to avoid this, the solution I implemented on my system consists in making the pcm.default a dmixer plugin :

pcm.!default{
        type plug
        slave.pcm "dmixer"
        hint{
                show on
                description "Tux Alsa Default"}}

For the record, here following my dmixer details :

pcm.dmixer{
        type dmix
        ipc_key 219345
        slave{
                pcm MAUDIO
                format S32_LE
                period_size 1024
                buffer_size 4096 }}

As well as my MAUDIO pcm, just in order for you to notice the nonblock true definition :

pcm.MAUDIO{
        type hw
        card M2496
        device 0
        subdevice 0
        nonblock true}
1
  • Firefox is working fine with card0 and alsa only so I do think it could work with card1 (usb). I'll update my post for because I have new informations. ty
    – grrr
    Commented Feb 16 at 18:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .