Getting Pulseaudio and alsa to share one sound card
Georg Chini
georg at chini.tk
Fri May 10 05:26:58 UTC 2024
Hi,
when you are changing default.pa anyway, you can comment out the lines
loading module-udev-detect and module-detect near the top of the file.
Usually,
module-detect is not loaded anyway. Also, you can load module-alsa-sink and
module-alsa-source at the same place. If you take a look at default.pa,
there are
some examples.
Regards
Georg
On 08.05.24 19:02, Richard Reina wrote:
>
> Thanks for the idea George. I tried using dmix with the instructions
> in the link that you provided above but 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 <http://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.
>
>
> El mar, 7 may 2024 a las 14:59, Georg Chini (<georg at chini.tk>) escribió:
>
> Hi,
>
> mh, looks like you have a problem then. Pulseaudio exclusively
> opens the sound devices, so
> if the player cannot be configured to use the alsa default device,
> it will not work. You could
> try using dmix (https://wiki.archlinux.org/title/PulseAudio
> chapter 5.1.3, just used Google,
> did not check the content)
>
> The only other option left is to start the player with
> pasuspender, but then again ledfx won't
> work while the player is active.
>
> Regards
> Georg
>
> On 07.05.24 21:50, Richard Reina wrote:
>> $ aplay -L
>> null
>> Discard all samples (playback) or generate zero samples (capture)
>> default
>> Playback/recording through the PulseAudio sound server
>> 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
>> 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
>>
>> El mar, 7 may 2024 a las 14:44, Georg Chini (<georg at chini.tk>)
>> escribió:
>>
>> Hi,
>>
>> so what's the output of aplay -L?
>>
>> Regards
>> Georg
>>
>> On 07.05.24 21:12, Richard Reina wrote:
>>> Hello Georg, Thank you for the reply. Yes Moode accesses
>>> alsa directly and unfortunately there is no option for
>>> making it use pulse.
>>>
>>> El mar, 7 may 2024 a las 13:33, Georg Chini
>>> (<georg at chini.tk>) escribió:
>>>
>>> Hello,
>>>
>>> maybe you don't have the alsa config for pulseaudio.
>>> Normally aplay -L
>>> shows that the default device points to pulse:
>>>
>>> null
>>> Discard all samples (playback) or generate zero
>>> samples (capture)
>>> default
>>> Playback/recording through the PulseAudio sound server
>>>
>>> ...
>>>
>>> pulse
>>> PulseAudio Sound Server
>>>
>>> ...
>>>
>>> I guess the Moode audio player tries to access the ALSA
>>> device directly
>>> and fails because the device is already in use by
>>> pulseaudio. There might
>>> also be a configuration option in the player to make it
>>> use pulse.
>>>
>>> Regards
>>> Georg
>>>
>>> On 07.05.24 18:34, Richard Reina wrote:
>>>> Yes it's a requirement. Setting the audio device to
>>>> pulse in Ledfx is the only way it will work.
>>>>
>>>> El mar, 7 may 2024 a las 11:21, Mark Gaiser
>>>> (<markg85 at gmail.com>) escribió:
>>>>
>>>> Have you tried changing your device in ledfx to pulse?
>>>> https://ledfx.readthedocs.io/en/latest/directing_audio.html
>>>>
>>>> Again no idea if this works, I don't know nor use
>>>> ledfx :) Just trying to help out.
>>>>
>>>> On Tue, May 7, 2024 at 6:14 PM Richard Reina
>>>> <gatorreina at gmail.com> wrote:
>>>>
>>>> Hi Mark,
>>>>
>>>> Thank you for the reply. paplay also works but
>>>> there's no change. It's not the playing of the
>>>> song that locks up the device and causes Moode
>>>> audio not to be able to use it, it's the
>>>> starting of ledfx. Once I do systemctl start
>>>> ledfx the moode audio player can no longer use
>>>> the output device regardless if I play a sound
>>>> file with aplay, paplay or don't play a sound
>>>> file at all. Moode audio can't use the device
>>>> until I do systemctl stop ledfx.
>>>>
>>>> El mar, 7 may 2024 a las 10:48, Mark Gaiser
>>>> (<markg85 at gmail.com>) escribió:
>>>>
>>>> Can you use paplay instead?
>>>> That is the pulseaudio aplay drop-in
>>>> replacement.
>>>> I'm guessing you won't have "device or
>>>> resource busy" errors when using paplay.
>>>>
>>>> I did not test this! But do let us know if
>>>> it works for you :)
>>>>
>>>> On Tue, May 7, 2024 at 3:24 PM Richard
>>>> Reina <gatorreina at gmail.com> wrote:
>>>>
>>>> I have a Raspberry Pi 3b with a
>>>> Hifiberry Amp4/DAC hat runs Moode Audio OS.
>>>>
>>>> If I pick |Pulse| as they audio device
>>>> in LedFx and play a sound file with
>>>> |aplay sound_file.wav| my leds react to
>>>> the music.
>>>>
>>>> The problem is that after |aplay| has
>>>> finished playing the sound file if I
>>>> then go try to use Moode audio player
>>>> Moode audio won't play music and gives
>>>> me the following error:
>>>>
>>>> |MPD error Failed to open "ALSA
>>>> Default" (alsa); Failed to open ALSA
>>>> device "_audioout": Device or resource
>>>> busy|
>>>>
>>>> This persists until I stop Ledfx. Is
>>>> there a way I can switch back and forth
>>>> between aplay and Moode Audio player
>>>> without having to stop and start Ledfx?
>>>> I am not looking to get LedFx working
>>>> with Moode I only want reactive lights
>>>> when I play a song with |aplay|.
>>>>
>>>> $ 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
>>>>
>>>> $ amixer
>>>> Simple mixer control 'Master',0
>>>> Capabilities: pvolume pswitch
>>>> pswitch-joined
>>>> Playback channels: Front Left - Front
>>>> Right
>>>> Limits: Playback 0 - 65536
>>>> Mono:
>>>> Front Left: Playback 65536 [100%] [on]
>>>> Front Right: Playback 65536 [100%] [on]
>>>> Simple mixer control 'Capture',0
>>>> Capabilities: cvolume cswitch
>>>> cswitch-joined
>>>> Capture channels: Front Left - Front
>>>> Right
>>>> Limits: Capture 0 - 65536
>>>> Front Left: Capture 65536 [100%] [on]
>>>> Front Right: Capture 65536 [100%] [on]
>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20240510/e92163b5/attachment-0001.htm>
More information about the pulseaudio-discuss
mailing list