Help understanding output = autoaudiosink please

I’m running Mopidy 3.4.1 on a Raspberry Pi and I’m trying to get the output to a USB Codec (Behringer 222).

I have it all working via the 3.5mm jack output on the Pi so I have the Mopidy installation mostly right.

I’m trying to understand what “output = autoaudiosink” actually means in the configuration. Does it mean that output will be sent to all devices detected by “aplay -l”, or will it just go to the first device it finds, or what?

My USB Codec is detected by “aplay -l” :-

chris@homepi$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
  Subdevices: 7/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 1: CODEC [USB Audio CODEC], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: vc4hdmi0 [vc4-hdmi-0], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 3: vc4hdmi1 [vc4-hdmi-1], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
chris@homepi$

So should it ‘just work’ or do I need something more explicit in the configuration to get the output to go to the USB Codec?

"

It’s a GStreamer item; It means use the most appropriate audio sink.

When there’re multiple sound cards, one can use alsamixer to select the card to use; It’s also possible to edit /etc/asound.conf to select the default card to use at boot time.

Matthias_Meulien [1]Matthias_Meulien
December 17

 chrisisbd:

 (…) I’m trying to understand what “output = autoaudiosink” actually
 means in the configuration.

It’s a GStreamer item; It means use the most appropriate audio sink.

How does it decide what is “the most appropriate audio sink”? :slight_smile:

When there’re multiple sound cards, one can use alsamixer to select the
card to use; It’s also possible to edit /etc/asound.conf to select the
default card to use at boot time.

OK, I can use alsamixer to show and select which device to use, though
I don’t quite understand why they are all prefixed with ‘default’,
are they all selected or what?

I can’t find any sort of docmentation on the system that tells me the
format of the /etc/asound.conf file. Searching on-line produces all
sorts of (mostly) long and complicated explanations and complaints
that “it doesn’t work for me”. However I will persevere! :slight_smile:

Thanks for the help so far.

Sort answer. Two options:

  1. Leave your default audio device as it is (headphones) and explicitly tell Mopidy to use a different device. In order to specify a device param you need to also specify you’re using alsasink.
[audio]
output = alsasink device=hw:1,0
  1. Change the system’s default audio device and then autoaudiosink will “just work”. Do this by following our installation instructions at Raspberry Pi — Mopidy 3.4.2 documentation which mentions changing the user’s default audio device (step 4) and then making that change system-wide (step 5).

Longer answer:

How does it decide what is “the most appropriate audio sink”?

I don’t think you need to worry about this. For Raspberry Pi it’s normally going to use alsasink. The actual issue is what audio device is it going to use.

Since you have multiple audio devices, and you seemingly don’t want to use your system’s default audio device (headphone jack) which would “just work”, you need some way to tell it which device to use. You can do that via your Mopidy config file (my 1st short answer), or changing the system settings (my 2nd short answer).

There is documentation at Asoundrc - AlsaProject. There are also examples in this forum but it’s not always easy to find it hidden amongst the more exotic examples. I would suggest following our documentation instead and not getting bogged down in manually editing alsa config files unless you have to. When you use raspi-config to change the default audio device, it automatically creates the alsa config file you need. Have a look at what you get.

1 Like

Thank you for the long and comprehensive reply.

I have put the following in /etc/asound.conf and it now outputs via
the USB codec:-

defaults.pcm.card 1
defaults.ctl.card 1

Job done! :slight_smile: