Configure Mopidy to use the desired Alsa card

I erroneously thought Mopidy wasn’t sending output to alsasink until I turned on my HDMI device. Turns out “aplay -l” enumerates four cards, HDMI 1, HDMI 2, headphones, and my Hifiberry audio device. I get output from gsi-launch-1.0 from my Hifiberry. It just works!

How can I configure Mopidy to use the right Alsa card?

Am I asking the wrong question b/c it’s Alsa that needs to be configured? (Does user pi look for alsa config somewhere other than where user mopidy looks for it?)

Step 5 of Raspberry Pi — Mopidy 3.1.1-1-gf17acacf documentation

You’re onto something here. I’m pretty sure this isn’t a mopidy config issue. I did as you instructed and it didn’t help, BUT I went further and ran these tests:

aplay /usr/share/sounds/alsa/Front_Center.wav

It played thru the hifiberry as expected.

sudo -u mopidy aplay /usr/share/sounds/alsa/Front_Center.wav

It played thru the HDMI (unexpected).

This made me think there was a user mopidy vs user pi issue, so I tried this:

sudo -u pi aplay /usr/share/sounds/alsa/Front_Center.wav

This played thru the HDMI. (UNEXPECTED!) and this makes me believe my issue is with Alsa setup. Somehow…

alsasink has a device property that let you set a specific device. There are examples at Search results for 'alsasink device' - Mopidy Discourse.

Something like:

[audio]
output = alsasink device=hw:sndrpihifiberry

You can use aplay -L (big L) to get the actual device name to use. Using device name is better than device indexes as indexes may change as you add/remove other audio devices.

WOW. That worked. I hope I didn’t miss any obvious documentation telling me to add device= after alsasink.

I’d had problems (in another context) with non-constant index numbers, using the device name is definitely the better way.

Thanks again!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.