You are not logged in.

#1 2019-06-13 10:30:49

Mladia
Member
Registered: 2016-04-30
Posts: 59

ALSA configuration

I cannot manage to properly get sound with ASLA

I have configured /etc/asound.conf and

 aplay -D sysdefault:CARD=ALSA test.wav

works as wanted, but just simply

 aplay test.wav

gives me

LSA lib pcm_dmix.c:1052:(snd_pcm_dmix_open) unable to open slave
aplay: main:788: audio open error: Device or resource busy

This doesn't make sense to me. Sysdefault should be the the default configuration for the system, right?


I have configured ALSA so that I can have more applications playing in the same time and have an external an soundcard, which I've moved to device 0 with modprobe. Here is my current configuration:

 aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Device [USB Audio Device], device 0: USB Audio [USB Audio]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 1: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 7/7
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
card 1: ALSA [bcm2835 ALSA], device 1: bcm2835 IEC958/HDMI [bcm2835 IEC958/HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
mic
speaker
dmixed
dsnooped
asymed
pasymed
dsp0
arts
default
sysdefault:CARD=Device
    USB Audio Device, USB Audio
    Default Audio Device
front:CARD=Device,DEV=0
    USB Audio Device, USB Audio
    Front speakers
surround21:CARD=Device,DEV=0
    USB Audio Device, USB Audio
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=Device,DEV=0
    USB Audio Device, USB Audio
    4.0 Surround output to Front and Rear speakers
surround41:CARD=Device,DEV=0
    USB Audio Device, USB Audio
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Device,DEV=0
    USB Audio Device, USB Audio
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Device,DEV=0
    USB Audio Device, USB Audio
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Device,DEV=0
    USB Audio Device, USB Audio
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=Device,DEV=0
    USB Audio Device, USB Audio
    IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=Device,DEV=0
    USB Audio Device, USB Audio
    Direct sample mixing device
dsnoop:CARD=Device,DEV=0
    USB Audio Device, USB Audio
    Direct sample snooping device
hw:CARD=Device,DEV=0
    USB Audio Device, USB Audio
    Direct hardware device without any conversions
plughw:CARD=Device,DEV=0
    USB Audio Device, USB Audio
    Hardware device with all software conversions
sysdefault:CARD=ALSA
    bcm2835 ALSA, bcm2835 ALSA
    Default Audio Device
dmix:CARD=ALSA,DEV=0
    bcm2835 ALSA, bcm2835 ALSA
    Direct sample mixing device
dmix:CARD=ALSA,DEV=1
    bcm2835 ALSA, bcm2835 IEC958/HDMI
    Direct sample mixing device
dsnoop:CARD=ALSA,DEV=0
    bcm2835 ALSA, bcm2835 ALSA
    Direct sample snooping device
dsnoop:CARD=ALSA,DEV=1
    bcm2835 ALSA, bcm2835 IEC958/HDMI
    Direct sample snooping device
hw:CARD=ALSA,DEV=0
    bcm2835 ALSA, bcm2835 ALSA
    Direct hardware device without any conversions
hw:CARD=ALSA,DEV=1
    bcm2835 ALSA, bcm2835 IEC958/HDMI
    Direct hardware device without any conversions
plughw:CARD=ALSA,DEV=0
    bcm2835 ALSA, bcm2835 ALSA
    Hardware device with all software conversions
plughw:CARD=ALSA,DEV=1
    bcm2835 ALSA, bcm2835 IEC958/HDMI
    Hardware device with all software conversions

/etc/asound.conf:

pcm.!default {
    type plug
    slave.pcm "asymed"
}

ctl.!default {
    type hw           
    card 0
}

pcm.mic {
  type plug
  slave {
    pcm "hw:0,0"
  }
}

pcm.dmixed {
        ipc_key 1029
        ipc_perm 0666
        type dmix
        slave {
            pcm "hw:0,0"      # you cannot use a "plug" device here, darn.
            period_time 0
            period_size 1024  # must be power of 2
            buffer_size 16384
#            channels 1
        }
}

#one called "dsnooped" for capturing
pcm.dsnooped {
        ipc_key 1027
        #icp_perm 0666
        type dsnoop
        slave.pcm "hw:0,0"
}
#and this is the real magic
pcm.asymed {
        type asym
        playback.pcm "dmixed"
        capture.pcm "mic"
}
#a quick plug plugin for above device to do the converting magic
pcm.pasymed {
        type plug
        slave.pcm "asymed"
}
#a ctl device to keep xmms happy
ctl.pasymed {
        type hw
        card 0
}

#for aoss:
pcm.dsp0 {
        type plug
        slave.pcm "asymed"
}

pcm.arts {
        type plug
        slave.pcm "asymed"
}

ctl.mixer0 {
        type hw
        card 0
}

This snipped I found in some ALSA mailing list and I modified it a little bit to fit my purposes.

~/.asoundrc is empty.

Offline

#2 2019-06-13 11:25:03

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,423

Re: ALSA configuration

sysdefault is "by default" a hardcoded exclusive access identifier for hw:0,0 (read: no dmix, no plug, no conversions)

FWIW I'd simply say remove that asound.conf. Retry without it, properly fix any issues if there actually are any. Right now 60% of that file is useless (as most is the default or deprecated anyway) the other 40% are for very specific usecases (what for and why exactly do you need the asym definition? If you don't know and just randomly copy pasted, then don't randomly copy paste). Also you will probably rather want to add your default overrides to the end of the file and not the beginning.

If that didn't already help post

sudo fuser -v /dev/snd/*

Last edited by V1del (2019-06-14 12:33:42)

Offline

Board footer

Powered by FluxBB