Pulseaudio and "Built-in Audio" issue (involves ALSA)


 Share

1 1

Recommended Posts

Some people noticed that Pulseaudio mixes is showing "Built-in Audio" for all the audio devices of the SBCs.

I investigated and found that the issue is related to ALSA: the devices are not really exposed by their real hardware connection (HDMI, SPDIF, ...) but just as "hw" devices. Pulseaudio is interpreting this as built-in audio because does not know anything else of the device.

 

I'm no ALSA expert at all, copied some already existing configuration files without really understanding what I did, I found a solution.

 

To solve the problem with SPDIF and HDMI you need to place the following two configuration files in /usr/share/alsa/card. Call the first one SPDIF-OUT.conf and the second one HDMI-OUT.conf

 

# configuration for SPDIF connections which just expose the
# audio out device

<confdir:pcm/iec958.conf>

SPDIF-OUT.pcm.iec958.0 {
        @args [ CARD AES0 AES1 AES2 AES3 ]
        @args.CARD {
                type string
        }
        @args.AES0 {
                type integer
        }
        @args.AES1 {
                type integer
        }
        @args.AES2 {
                type integer
        }
        @args.AES3 {
                type integer
        }
	type hw
	card $CARD

}

# configuration for HDMI connection which just expose the
# audio out device

<confdir:pcm/hdmi.conf>

HDMI-OUT.pcm.hdmi.0 {
        @args [ CARD DEVICE CTLINDEX AES0 AES1 AES2 AES3 ]
        @args.CARD {
                type string
        }
        @args.DEVICE {
                type integer
        }
        @args.CTLINDEX {
                type integer
        }
        @args.AES0 {
                type integer
        }
        @args.AES1 {
                type integer
        }
        @args.AES2 {
                type integer
        }
        @args.AES3 {
                type integer
        }
        type hw
	card $CARD 
}

Then discover your audio device names:

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: SPDIF [SPDIF], device 0: ff8b0000.sound-dit-hifi dit-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: DWI2SHDMI [DW-I2S-HDMI], device 0: ff890000.i2s-i2s-hifi i2s-hifi-0 []
  Subdevices: 0/1
  Subdevice #0: subdevice #0

Mine are "SPDIF" and "DW-I2S-HDMI" - these two strings come from the device tree so each board may have their own peculiar device names.

 

And finally edit the file /usr/share/alsa/conf/aliases.conf adding the cards to the list, to get something like this (I just added the SPDIF and DW-I2S-HDMI device at the bottom of the list to alias to the right cards):

#
#  Define aliases for various drivers
#

YMF724 cards.YMF744
YMF724F cards.YMF744
YMF740 cards.YMF744
YMF740C cards.YMF744
YMF754 cards.YMF744
CMIPCI cards.CMI8338
CMI8738 cards.CMI8338
CMI8738-SWIEC cards.CMI8338-SWIEC
CMI8738-MC4 cards.CMI8738-MC6
'E-mu APS' cards.EMU10K1
'GUS MAX' cards.GUS
'GUS ACE' cards.GUS
'GUS Extreme' cards.GUS
'AMD InterWave' cards.GUS
'Dynasonic 3-D' cards.GUS
'InterWave STB' cards.GUS
au8810 cards.AU8810
au8820 cards.AU8820
au8830 cards.AU8830
Prodigy71 cards.Aureon71
Prodigy71LT cards.Aureon71
Prodigy71HIFI cards.Aureon71
Aureon71Univ cards.Aureon71
VIA82XX-MODEM cards.ICH-MODEM
'MPU-401 UART' cards.MPU-401
'VX222/Old' cards.VX222
'VX222/v2' cards.VX222
'VX222/Mic' cards.VX222
'CMI8330/C3D' cards.CMI8330
'SB AWE' cards.SBAWE
'SB Pro' cards.SBPro
'PMac Burgundy' cards.PMac
'PMac DACA' cards.PMac
'PMac Tumbler' cards.PMac
'PMac Snapper' cards.PMac
'PMac Screamer' cards.PMac
'PMac AWACS' cards.PMac
'PMac Toonie' cards.PMacToonie
AppleOnbdAudio cards.PMacToonie
'USB US-X2Y' cards.US-X2Y
'Serial MIDI' cards.SerialMIDI
'Prodif Plus' cards.ProdifPlus
ESM1 cards.ES1968
ES1978 cards.ES1968
Allegro cards.Maestro3
Canyon3D-2 cards.Maestro3
Azalia cards.HDA-Intel
aaci-pl041 cards.AACI
AV66 cards.CMI8788
AV100 cards.CMI8788
AV200 cards.CMI8788
CMI8786 cards.CMI8788
CMI8787 cards.CMI8788
SPDIF cards.SPDIF-OUT
DW-I2S-HDMI cards.HDMI-OUT

<confdir:pcm/default.conf>
<confdir:pcm/dmix.conf>
<confdir:pcm/dsnoop.conf>

 

Now running aplay -L you should see, among the other generic devices, spdif and HDMI devices with the proper device tag:

$ aplay -L
...
iec958:CARD=SPDIF,DEV=0
    SPDIF, 
    IEC958 (S/PDIF) Digital Audio Output
...
hdmi:CARD=DWI2SHDMI,DEV=0
    DW-I2S-HDMI, 
    HDMI Audio Output
...

Then reboot (or run pulseaudio -k from a shell as non-root user) and finally pulseaudio mixer should show this:

Screenshot_2019-04-21_13-20-06.png.8b7f82bca1a17dceea16cc5efa60c7b0.png

 

 

I'm eager to understand what the hell I did, but also I would like to transform the thing in something that works directly from asound.conf instead of having cards configuration files in alsa directories, so any correction and explanation is very welcome

 

 

Link to post
Share on other sites

Armbian is a community driven open source project. Do you like to contribute your code?

Guest
This topic is now closed to further replies.
 Share

1 1