No audio output with Mopidy + Mopidy Iris + HiFiBerry DAC+ Pro [solved]

Hi there^^

I hope you can help me. I have basically no idea of Linux and this is the first thing i try to do with a Linux system, so please forgive me, if i’m asking a “stupid/noob” question.

I’ve tried serveral combinations by changing configuration of

  • [audio] mixer, output
  • [alsamixer] with different options
  • [softwaremixer] enabled/disabled

But my combination never worked to make Mopidy play sound through my HiFiBerry DAC+ Pro sound card, so i hope someone here can help me figure out the problem (after i changed something i always did restart Mopidy with the command “sudo systemctl restart mopidy”).

The strange thing is that i’m able to open a browser on my raspberry pi, go to youtube and play a video and the sound is working. But with Mopidy as a service it doesn’t make any sound at all, not with the Mopidy Iris client and also the test sound is not doing any sound.

The setup i have is as follows:

  • System: Raspbian GNU/Linux 9 (stretch) on a Raspberry Pi 3 B+ (plus) with a HiFiBerry DAC+ Pro sound card
  • Mopidy version: 2.1.0
  • Mopidy-Iris version: 3.21.1

Mopidy status:

Summary

mopidy.service - Mopidy music server
Loaded: loaded (/lib/systemd/system/mopidy.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2018-06-15 12:45:57 CEST; 33min ago
Process: 1323 ExecStartPre=/bin/chown mopidy:audio /var/cache/mopidy (code=exited, status=0/SUCCESS)
Process: 1320 ExecStartPre=/bin/mkdir -p /var/cache/mopidy (code=exited, status=0/SUCCESS)
Main PID: 1326 (mopidy)
CGroup: /system.slice/mopidy.service
└─1326 /usr/bin/python /usr/bin/mopidy --config /usr/share/mopidy/conf.d:/etc/mopidy/mopidy.conf

Jun 15 12:46:00 HifiPi mopidy[1326]: INFO No local library metadata cache found at /var/lib/mopidy/local/library.json.gz. Please run `mopidy lo
Jun 15 12:46:00 HifiPi mopidy[1326]: INFO Loaded 0 local tracks using json
Jun 15 12:46:01 HifiPi mopidy[1326]: INFO Starting Mopidy core
Jun 15 12:46:01 HifiPi mopidy[1326]: INFO Logged in to Spotify in offline mode
Jun 15 12:46:01 HifiPi mopidy[1326]: INFO Starting Mopidy frontends: QueueManagerFrontend, IrisFrontend, MpdFrontend, HttpFrontend
Jun 15 12:46:01 HifiPi mopidy[1326]: INFO Starting Iris 3.21.1
Jun 15 12:46:01 HifiPi mopidy[1326]: INFO MPD server running at [::ffff:0.0.0.0]:6600
Jun 15 12:46:01 HifiPi mopidy[1326]: INFO HTTP server running at [::ffff:0.0.0.0]:6680
Jun 15 12:46:01 HifiPi mopidy[1326]: INFO Starting GLib mainloop
Jun 15 12:46:01 HifiPi mopidy[1326]: INFO Logged in to Spotify in online mode

Mopidy config (changes done via “sudo nano /etc/mopidy/mopidy.conf” - but no success)

Summary

Running “/usr/bin/mopidy --config /usr/share/mopidy/conf.d:/etc/mopidy/mopidy.conf config” as user mopidy
[core]
cache_dir = /var/cache/mopidy
config_dir = /etc/mopidy
data_dir = /var/lib/mopidy
max_tracklist_length = 10000
restore_state = false

[logging]
color = true
console_format = %(levelname)-8s %(message)s
debug_format = %(levelname)-8s %(asctime)s [%(process)d:%(threadName)s] %(name)s\n %(message)s
debug_file = /var/log/mopidy/mopidy-debug.log
config_file = /etc/mopidy/logging.conf

[audio]
mixer = software
mixer_volume = 50
output = alsasink
buffer_time =

[proxy]
scheme =
hostname =
port =
username =
password =

[mopify]
enabled = true
debug = false

[local-images]
enabled = true
library = json
base_uri = /images/
image_dir =
album_art_files =
*.jpg
*.jpeg
*.png

[iris]
enabled = true
country = ****
locale = ****
spotify_authorization_url = ****
lastfm_authorization_url = ****
snapcast_enabled = false
snapcast_host = ****
snapcast_port = ****

[mpd]
enabled = true
hostname = ****
port = ****
password = ****
max_connections = 20
connection_timeout = 60
zeroconf = Mopidy MPD server on $hostname
command_blacklist =
listall
listallinfo
default_playlist_scheme = m3u

[http]
enabled = true
hostname = ****
port = ****
static_dir =
zeroconf = Mopidy HTTP server on $hostname

[stream]
enabled = true
protocols =
http
https
mms
rtmp
rtmps
rtsp
metadata_blacklist =
timeout = 5000

[m3u]
enabled = true
base_dir =
default_encoding = latin-1
default_extension = .m3u8
playlists_dir = /var/lib/mopidy/playlists

[softwaremixer]
enabled = true

[file]
enabled = true
media_dirs =
$XDG_MUSIC_DIR|Music
~/|Home
excluded_file_extensions =
.jpg
.jpeg
show_dotfiles = false
follow_symlinks = false
metadata_timeout = 1000

[local]
enabled = true
library = json
media_dir = /var/lib/mopidy/media
scan_timeout = 1000
scan_flush_threshold = 100
scan_follow_symlinks = false
excluded_file_extensions =
.directory
.html
.jpeg
.jpg
.log
.nfo
.png
.txt

[youtube]
enabled = false ; Extension disabled by self check.

[tunein]
enabled = true
timeout = 5000

[spotify]
enabled = true
username = ********
password = ********
client_id = ********
client_secret = ********
bitrate = 320
volume_normalization = true
private_session = false
timeout = 10
allow_cache = true
allow_network = true
allow_playlists = true
search_album_count = 20
search_artist_count = 10
search_track_count = 50
toplist_countries =

[spotify_tunigo]
enabled = true
region =
sub_genres = true
cache_time = 3600

[soundcloud]
enabled = false ; Extension disabled by user config.

[scrobbler]
enabled = false ; Extension disabled by user config.

[podcast]
enabled = true
browse_root = Podcasts.opml
browse_order = desc
lookup_order = asc
cache_size = 64
cache_ttl = 86400
timeout = 10

[local-sqlite]
enabled = true
directories =
Albums local:directory?type=album
Artists local:directory?type=artist
Composers local:directory?type=artist&role=composer
Genres local:directory?type=genre
Performers local:directory?type=artist&role=performer
Release Years local:directory?type=date&format=%25Y
Tracks local:directory?type=track
Last Week’s Updates local:directory?max-age=604800
Last Month’s Updates local:directory?max-age=2592000
timeout = 10
use_album_mbid_uri = true
use_artist_mbid_uri = false
use_artist_sortname = false

[internetarchive]
enabled = true
retries = 3
browse_limit = 100
audio_formats =
VBR MP3
64Kbps MP3
base_url = http://archive.org
collections =
audio
etree
librivoxaudio
audio_bookspoetry
audio_tech
audio_music
audio_news
audio_foreign
audio_podcast
audio_religion
browse_views =
downloads desc|Views
titleSorter asc|Title
publicdate desc|Date Archived
date desc|Date Published
creatorSorter asc|Creator
timeout = 10
cache_size = 128
search_limit = 20
cache_ttl = 86400
image_formats =
JPEG
JPEG Thumb
search_order =

[alsamixer]
enabled = false ; Extension disabled by user config.

hardware devices with command “aplay -l”
results (translated to english by me):

Summary

**** List of hardware devices (PLAYBACK) ****
Card 0: ALSA [bcm2835 ALSA], Device 0: bcm2835 ALSA [bcm2835 ALSA]
Sub-Device: 7/7
Sub-Device #0: subdevice #0
Sub-Device #1: subdevice #1
Sub-Device #2: subdevice #2
Sub-Device #3: subdevice #3
Sub-Device #4: subdevice #4
Sub-Device #5: subdevice #5
Sub-Device#6: subdevice #6
Card 0: ALSA [bcm2835 ALSA], Device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
Sub-Device: 1/1
Sub-Device #0: subdevice #0
Card 1: sndrpihifiberry [snd_rpi_hifiberry_dacplus], Device 0: HiFiBerry DAC+ Pro HiFi pcm512x-hifi-0 []
Sub-Device: 1/1
Sub-Device #0: subdevice #0

Can anyone tell me what i have done wrong?
If you need to know anything additional, please let me know.
Thank you for your time and any help in advance.

Kind regards,

Taerion

PS: Please forgive my poor english, as i’m not a native speaker
PPS: edited to make things more clear

Hi, full marks for this post. All the info present and easy to read. Thanks!

aplay -l shows you have two soundcards present: the onboard one and your HiFiBerry DAC+ Pro. Since you mention it working in your web browser you must be using the Desktop version of Raspbian rather than the Lite version. I don’t use it, but if I remember correctly they configure which soundcard to use in the file /home/pi/.asoundrc. This allows programs running as user pi to use the correct soundcard. However, Mopidy as a service runs as user mopidy so it’s not privy to that information.

Assuming I am right and there is something to that effect in /home/pi/.asoundrc you can copy it to /etc/asound.conf so that programs running as other users (i.e. Mopidy) can use the correct settings.

Alternatively and maybe simpler is to just disable the onboard soundcard entirely so there is no chance of confusion. I believe this is still the recommended approach as documented in the HiFiBerry install guide.

Hi @kingosticks

thank you very much for your very quick and kind reply. Yes, i do use the full Desktop version of Raspbian (i thought it might have more software, drivers etc. with it and is easier to use for Linux-newbies, but actually i ended up using the terminal quite a lot which is quite unfamiliar for me).

You remember right, there is a file “.asoundrc” in the /home/pi folder.
As i was not able to copy the .asoundrc via the graphical user interface due to the Error message “Not correct permissions” (or something like that), i used the commandline (typed in the terminal “sudo cp .asoundrc /etc/asound.conf” (without the “” of course)), which created a asound.conf file in the etc/ folder (there was no file with that name in it before).

After that i restarted the mopidy service in the terminal with “sudo systemctl restart mopidy” and then opened the browser on a different pc in the same local network and entered “http://hifipi.local:****/iris/#/” to open the user interface (hifipi is the name of my raspberry pi and for **** the portnumber which is written under the [http] settings in the mopidy.conf) of my Mopidy-Iris client.

And: It perfectly worked :smile:

I also had a look at the HiFiBerry install guide you mentioned in the Link, but i thought it was outdated as it stated Linux version 4 or higher and i have Raspbian version 9 (which seems quite far away from version 4).

Anyway: thank you very much for your help, a big thx and i’m very happy that things are working now after 3 days try and error to install Raspbian, Mopidy and Mopidy-Iris :joy:

All the best,

Taerion

Glad it’s working.

It means kernel version 4. Raspbian 9 (AKA stretch) is the version of the operating system. They are separate. You can see your kernel version by running uname -r and you will find it’s version 4.something.something.

Oh, ok… i didn’t realise that Rasbian version number is not the same as the Linux version number.
Just checked and “uname -r” gives me the version: 4.14.34-v7+

Thanks for explaining that and all your quick and helpful posts :+1:t2:

Kind regards,

Taerion