Sharing audio device with another program

Need help with MPD?
Post Reply
buidiena3
Posts: 1
Joined: March 3rd, 2020, 3:54 am

Sharing audio device with another program

Post by buidiena3 »

On my raspberry pi running OSMC I want to run both Kodi and MPD (not a fan of the bulit-in Kodi audio player). They both need to use the same audio interface (Hifiberry Amp2). I believe they're currently both using ALSA (MPD certainly is).

Currently they conflict, since if one is already running, the other can't connect to the busy audio device.

What are my options to allow both to use the same audio device?

It's important to me that both can control the volume via the device's hardware mixer.

They don't necessarily need to output sound at the same moment -- I'm OK to pause one program before playing on the other, if that makes a difference. I just don't want to have to manually run any commands to switch between the two.

max
Forum team
Posts: 1024
Joined: January 15th, 2013, 3:43 pm

Re: Sharing audio device with another program

Post by max »

Whenever MPD stops or pauses playback, it releases the ALSA device. If all programs would do the same, you wouldn't have any any problems, but unfortunately, MPD seems to be the only program being cooperative about the ALSA device.

Other options are ALSA dmix (instead of direct ALSA hardware access), PulseAudio or other audio device sharing systems. But these will bring you increased CPU usage and reduced quality.

The best option would be to make Kodi release the device - talk to the Kodi developers about your problem!

conta
Posts: 100
Joined: October 31st, 2013, 4:59 pm

Re: Sharing audio device with another program

Post by conta »

@buidiena3

I had exactly the same issue as you have now. max is right - MPD is not the problem.
In Kodi there is a setting to make it release the alsa-device when Kodi is running in standby-mode. You just have to activate this setting and your problems are gone. ;)

doronbehar
Posts: 3
Joined: December 14th, 2018, 5:47 pm

Re: Sharing audio device with another program

Post by doronbehar »

There's also this recommended advice from the Arch WiKi: https://wiki.archlinux.org/index.php/Mu ... _mpd_user) .

Post Reply