Playing multiple sources at the same time with mopidy

Hi All,

i wonder whether is it possible to mix two mp3 sources in real time with mopidy, so the user can listen them as one stream.
for example a live stream is playing, and in case of an incoming message i would like to inform the listener about the event.
any feedback is highly appreciated.

An ALSA dmix plugin allows multiple processes to use the same audio hardware at the same time. E.g. Mopidy and your event sound playing program.

huge thanks for the answer. i’m going to check the dmix plugin!

I had the same challenge and just worked around Mopidy. As kingosticks mentioned, you can just use a “dmix” sound output for Mopidy and another application in parallel.

$aplay -L
...
dmix:CARD=system,DEV=0
    ADD ON USB Cinema system, USB Audio
    Direct sample mixing device
...

Then use mpg123 or another sound player
/usr/bin/mpg123 -a dmix:system welcome.mp3 >/dev/null 2>&1

I made a post about doing something similar to what you are talking about using pulseaudio here https://community.home-assistant.io/t/text-to-speech-and-music-at-the-same-time/172899. Although the post is geared toward Home Assistant the concept should work for anything that can connect to pulseaudio.

thanks for all the answers!

I’ve been trying to get dmix working with Mopidy.

What did you add under
[Audio]
in the mopidy config? I have tried many things like:
output = alsasink device=pcm.dmix
output = alsasink device=dmix
output = pcm.dmix
output = dmix
output = alsasink device=plug:dmix
output = plug:dmix

But none worked.
I have searched in this forum but all I find is different use cases or over and over the sentence “You should be able to configure an ALSA dmix plugin” but never really a proper how to.

I have dMix working with shairport by adding the line:
output_device = “pcm.dmix”
But as mentioned above the same does not work with mopidy.

Any help is appreciated, I have spent hours and hours trying to make this work. I’d say that is my last try to get mopidy play along, then I will probably have to move on to another player or even volumio…