Hi all,
So I tried to configure dmix:
$ 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
Added following line to /boot/config.txt:
dtoverlay=i2s-mmap
and created /etc/asound.conf with following content:
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
}
Changed Mopidy config and restarted:
[audio]
output = alsasink device=plug:dmixer
WORKED! Mopidy is using dmixer now. However, raspotify is not so eager to participate. Changed this in /etc/raspotify/conf:
# Displayed device type. Defaults to speaker.
LIBRESPOT_DEVICE_TYPE="dmix:CARD=sndrpihifiberry,DEV=0"
But once raspotify is started I get:
lip 25 11:53:11 pirateaudio systemd[1]: Started Raspotify (Spotify Connect Client).
lip 25 11:53:11 pirateaudio librespot[23338]: [2023-07-25T09:53:11Z ERROR librespot] Invalid `--device-type` / `-F`: "dmix:CARD=sndrpihifiberry,DEV=0"
lip 25 11:53:11 pirateaudio librespot[23338]: Valid `--device-type` / `-F` values: computer, tablet, smartphone, speaker, tv, avr, stb, audiodongle, gameconsole, castaudio, castvideo, automobile, smartwatch, chromebook, carthing, homething
lip 25 11:53:11 pirateaudio librespot[23338]: Default: Speaker
lip 25 11:53:11 pirateaudio systemd[1]: raspotify.service: Main process exited, code=exited, status=1/FAILURE
lip 25 11:53:11 pirateaudio systemd[1]: raspotify.service: Failed with result 'exit-code'.
lip 25 11:53:11 pirateaudio systemd[1]: raspotify.service: Triggering OnFailure= dependencies.
This is full aplay -L:
$ sudo -u mopidy aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
hifiberry
default
dmixer
hw:CARD=sndrpihifiberry,DEV=0
snd_rpi_hifiberry_dac, HifiBerry DAC HiFi pcm5102a-hifi-0
Direct hardware device without any conversions
plughw:CARD=sndrpihifiberry,DEV=0
snd_rpi_hifiberry_dac, HifiBerry DAC HiFi pcm5102a-hifi-0
Hardware device with all software conversions
sysdefault:CARD=sndrpihifiberry
snd_rpi_hifiberry_dac, HifiBerry DAC HiFi pcm5102a-hifi-0
Default Audio Device
dmix:CARD=sndrpihifiberry,DEV=0
snd_rpi_hifiberry_dac, HifiBerry DAC HiFi pcm5102a-hifi-0
Direct sample mixing device
hw:CARD=vc4hdmi,DEV=0
vc4-hdmi, MAI PCM i2s-hifi-0
Direct hardware device without any conversions
plughw:CARD=vc4hdmi,DEV=0
vc4-hdmi, MAI PCM i2s-hifi-0
Hardware device with all software conversions
sysdefault:CARD=vc4hdmi
vc4-hdmi, MAI PCM i2s-hifi-0
Default Audio Device
hdmi:CARD=vc4hdmi,DEV=0
vc4-hdmi, MAI PCM i2s-hifi-0
HDMI Audio Output
dmix:CARD=vc4hdmi,DEV=0
vc4-hdmi, MAI PCM i2s-hifi-0
Direct sample mixing device
And this is what 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
@kingosticks or anybody, can you please help me finding my mistake in configuration?