-
Notifications
You must be signed in to change notification settings - Fork 752
Description
Hi all,
I would like to ask you for some help. My hardware is Raspberry Pi Zero 2 W + Pirate Audio with a line-out. This s how it introduces itself:
$ sudo aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sndrpihifiberry [snd_rpi_hifiberry_dac], device 0: HifiBerry DAC HiFi pcm5102a-hifi-0 [HifiBerry DAC HiFi pcm5102a-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: vc4hdmi [vc4-hdmi], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
librespot was working fine with default ALSA settings, but it was competing with Mopidy for an audio device, this is why I tried to create mixing device with following ALSA configuration:
pcm.hifiberry {
type hw card 0
}
pcm.!default {
type plug
slave.pcm "dmixer"
}
pcm.dmixer {
type dmix
ipc_key 1024
slave {
pcm "hifiberry"
channels 2
}
}
ctl.dmixer {
type hw
card 0
}
I configured librespot to use dmix, but unfortunately each time I try to play anything being connected to librespot I get this error message:
lip 25 13:04:02 pirateaudio librespot[177560]: [2023-07-25T11:04:02Z ERROR librespot_connect::spirc] AutoplayError: MercuryError
lip 25 13:04:05 pirateaudio librespot[177560]: [2023-07-25T11:04:05Z ERROR librespot_playback::player] Audio Sink Error Invalid Parameters: <AlsaSink> Device dmix:CARD=sndrpihifiberry,DEV=0 Unsupported Format S16_LE (S16), ALSA function 'snd_pcm_hw_params_set_format' failed with error 'EINVAL: Invalid argument', Supported Format(s): ["S32"]
This is what devices librespot sees:
$ sudo librespot --device ?
[2023-07-25T10:01:21Z INFO librespot] librespot 0.4.2 a6e1258 (Built on 2023-06-21, Build ID: g9ifMDjd, Profile: release)
Compatible alsa device(s):
--------------------------------------------------------------------
Device:
hw:CARD=sndrpihifiberry,DEV=0
Description:
snd_rpi_hifiberry_dac, HifiBerry DAC HiFi pcm5102a-hifi-0
Direct hardware device without any conversions
Supported Format & Sample Rate Combinations:
Format: S16 Sample Rate(s): 44.1kHz, 48kHz, 88.2kHz, 96kHz
Format: S24 Sample Rate(s): 44.1kHz, 48kHz, 88.2kHz, 96kHz
Format: S32 Sample Rate(s): 44.1kHz, 48kHz, 88.2kHz, 96kHz
--------------------------------------------------------------------
Device:
plughw:CARD=sndrpihifiberry,DEV=0
Description:
snd_rpi_hifiberry_dac, HifiBerry DAC HiFi pcm5102a-hifi-0
Hardware device with all software conversions
Supported Format & Sample Rate Combinations:
Format: S16 Sample Rate(s): 44.1kHz, 48kHz, 88.2kHz, 96kHz
Format: S24 Sample Rate(s): 44.1kHz, 48kHz, 88.2kHz, 96kHz
Format: S24_3 Sample Rate(s): 44.1kHz, 48kHz, 88.2kHz, 96kHz
Format: S32 Sample Rate(s): 44.1kHz, 48kHz, 88.2kHz, 96kHz
Format: F32 Sample Rate(s): 44.1kHz, 48kHz, 88.2kHz, 96kHz
Format: F64 Sample Rate(s): 44.1kHz, 48kHz, 88.2kHz, 96kHz
--------------------------------------------------------------------
Device:
sysdefault:CARD=sndrpihifiberry
Description:
snd_rpi_hifiberry_dac, HifiBerry DAC HiFi pcm5102a-hifi-0
Default Audio Device
Supported Format & Sample Rate Combinations:
Format: S16 Sample Rate(s): 44.1kHz, 48kHz, 88.2kHz, 96kHz
Format: S24 Sample Rate(s): 44.1kHz, 48kHz, 88.2kHz, 96kHz
Format: S24_3 Sample Rate(s): 44.1kHz, 48kHz, 88.2kHz, 96kHz
Format: S32 Sample Rate(s): 44.1kHz, 48kHz, 88.2kHz, 96kHz
Format: F32 Sample Rate(s): 44.1kHz, 48kHz, 88.2kHz, 96kHz
Format: F64 Sample Rate(s): 44.1kHz, 48kHz, 88.2kHz, 96kHz
--------------------------------------------------------------------
Device:
dmix:CARD=sndrpihifiberry,DEV=0
Description:
snd_rpi_hifiberry_dac, HifiBerry DAC HiFi pcm5102a-hifi-0
Direct sample mixing device
Supported Format & Sample Rate Combinations:
Format: S32 Sample Rate(s): 48kHz
--------------------------------------------------------------------
ALSA lib pcm_dmix.c:1075:(snd_pcm_dmix_open) unable to open slave
Oh and dtoverlay=hifiberry-dac is inside /boot/config.txt and librespot version is 0.4.2 a6e1258 (Built on 2023-06-21, Build ID: g9ifMDjd, Profile: release).
I'm quite new to ALSA configuration to be honest.. I think I should change dmix device format, but not sure how to achieve that. I also have suspicion about /etc/asound.conf whether it's being applied, because without it "aplay -L" gives me identical output.. Also "unable to open slave" on dmix is worrying me as it was supposed to be shared.
Can you please guide me a little bit? Thank you.