On a Raspberry Pi with a DAC/AMP HAT running Moode Audio OS I have installed LedFX for reactive LEDs just to use with aplay
and not with Moode. However, every time I start up LedFX with systemctl start ledfx
, so that I can use aplay
to play a sound file for the lights, I am prevented from going back to listening to Moode Audio after aplay
has finished playing the sound file. I get the following error from Moode:
MPD error Failed to open "ALSA Default" (alsa); Failed to open ALSA device "_audioout": Device or resource busy
This persists until I do: systemctl stop ledfx
.
Moode Audio accesses alsa directly and there appears to be no way to make it use pulseaudio
. LedFx requires pulseaudio
and there appears to be no way around using it.
I have read here https://wiki.archlinux.org/title/PulseAudio (sec. 5.1.3) that dmix
can be used to allow one to “use ALSA directly in most of your applications while still being able to use applications which require PulseAudio at the same time.” however it instructs to create a .pa file in the directory: /etc/pulse/default.pa.d/
but this is a directory that does not exist on the RPI. I have tried appending the lines:
unload-module module-udev-detect
unload-module module-detect
load-module module-alsa-sink device=dmix
load-module module-alsa-source device=dsnoop
to my /etc/pulse/default.pa
but that causes aplay to give a busy error: aplay: main:830: audio open error: Device or resource busy
and Moode to also still give one as well.
Is swithcing back and forth between LedFx and Moode Audio even possible without stopping LedFx each time? If so can the above prescribed, or any other, solution be made to work?
$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sndrpihifiberry [snd_rpi_hifiberry_dacplus], device 0: HiFiBerry DAC+ HiFi pcm512x-hifi-0 [HiFiBerry DAC+ HiFi pcm512x-hifi-0]
Subdevices: 0/1
Subdevice #0: subdevice #0
$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sndrpihifiberry [snd_rpi_hifiberry_dacplus], device 0: HiFiBerry DAC+ HiFi pcm512x-hifi-0 [HiFiBerry DAC+ HiFi pcm512x-hifi-0]
Subdevices: 0/1
Subdevice #0: subdevice #0
below is output from aplay -L after the default.pa file is modified.
richard@casey-kasem:~ $ aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
lavrate
Rate Converter Plugin Using Libav/FFmpeg Library
samplerate
Rate Converter Plugin Using Samplerate Library
speexrate
Rate Converter Plugin Using Speex Resampler
jack
JACK Audio Connection Kit
oss
Open Sound System
pulse
PulseAudio Sound Server
upmix
Plugin for channel upmix (4,6,8)
vdownmix
Plugin for channel downmix (stereo) with a simple spacialization
_audioout
_audioout__
alsaequal
plug_alsaequal
btstream
camilladsp
crossfeed
plug_bs2b
eqfa12p
plug_eqfa12p
invpolarity
trx_send
hw:CARD=sndrpihifiberry,DEV=0
snd_rpi_hifiberry_dacplus, HiFiBerry DAC+ HiFi pcm512x-hifi-0
Direct hardware device without any conversions
plughw:CARD=sndrpihifiberry,DEV=0
snd_rpi_hifiberry_dacplus, HiFiBerry DAC+ HiFi pcm512x-hifi-0
Hardware device with all software conversions
default:CARD=sndrpihifiberry
snd_rpi_hifiberry_dacplus, HiFiBerry DAC+ HiFi pcm512x-hifi-0
Default Audio Device
sysdefault:CARD=sndrpihifiberry
snd_rpi_hifiberry_dacplus, HiFiBerry DAC+ HiFi pcm512x-hifi-0
Default Audio Device
dmix:CARD=sndrpihifiberry,DEV=0
snd_rpi_hifiberry_dacplus, HiFiBerry DAC+ HiFi pcm512x-hifi-0
Direct sample mixing device
usbstream:CARD=sndrpihifiberry
snd_rpi_hifiberry_dacplus
USB Stream Output