I was having issues getting Mopidy running on my hobby RPi 3B. So today I flashed a new Raspian Stretcher image (Linux raspberrypi 4.9.59-v7+ #1047 SMP Sun Oct 29 12:19:23 GMT 2017 armv7l GNU/Linux) and started the Mopidy (2.1.0) install and configuration from scratch. With the current Raspian Stretcher release, bluez-alsa comes as the default rather than PulseAudio. This simplified the install (i.e., Bluetooth audio support) considerably.
My original hobby system install was Raspian Jessie installed a year ago and upgraded. I then built bluez-alsa in order to send audio to a Bluetooth speaker. I had mpd working so I could listen to Internet radio over the Bluetooth speaker. I wanted to play Spotify playlists which is what brought me to Mopidy. This is all actually a project to get Spotify and Bluetooth tested so I can port the setup to my AIY Voice Kit so I can play Spotify via voice commands to the Google Assistant. But I digress.
I am using mpc because I need to get a cli based interface to work in order to retrofit my AIY Voice Kit. I have now partially succeeded in getting mopidy-spotify to play over Bluetooth… If I run Mopidy from a terminal window I can get audio to play by adding a Spotify playlist (mpc add “spotify-uri” && mpc play). However, if I run Mopidy as a service, there is no audio. Inspecting the logs shows no errors. mpc status / mpc current return the expected (successful) results about what’s “playing”. But just no sound.
I have searched through this forum and searched for “no sound” “mopidy as a service” in general and none of the discussions I read were quite the situation I’m experiencing and none of them provided any suggestions which gave any guidance to troubleshooting my issue.
My ~/.config/mopidy/mopidy.conf file is the default file created by “mopidy config” with these edits:
[audio]
output = alsasink
[local]
enabled = false
[spotify]
username = <Spotify Username>
password = <Spotify Password>
#https://www.mopidy.com/authenticate/#spotify
client_id = <string returned by the mopidy authenticate webpage>
client_secret = <string returned by the mopidy authenticate webpage>
bitrate = 320
pi@raspberrypi:~ $ mopidy
INFO Starting Mopidy 2.1.0
INFO Loading config from builtin defaults
INFO Loading config from /home/pi/.config/mopidy/mopidy.conf
INFO Loading config from command line options
INFO Enabled extensions: spotify, mpd, http, stream, m3u, softwaremixer, file
INFO Disabled extensions: local
INFO Starting Mopidy mixer: SoftwareMixer
INFO Starting Mopidy audio
INFO Starting Mopidy backends: StreamBackend, M3UBackend, FileBackend, SpotifyBackend
INFO Audio output set to "alsasink"
INFO Starting Mopidy core
INFO Logged in to Spotify in offline mode
INFO Logged in to Spotify in online mode
INFO Starting Mopidy frontends: MpdFrontend, HttpFrontend
INFO MPD server running at [::ffff:127.0.0.1]:6600
INFO HTTP server running at [::ffff:127.0.0.1]:6680
INFO Starting GLib mainloop
INFO New MPD connection from [::ffff:127.0.0.1]:53542
...
The Mopidy service configuration file (/etc/mopidy/mopidy.conf):
[core]
cache_dir = /var/cache/mopidy
config_dir = /etc/mopidy
data_dir = /var/lib/mopidy
[logging]
config_file = /etc/mopidy/logging.conf
debug_file = /var/log/mopidy/mopidy-debug.log
[local]
enabled = false
media_dir = /var/lib/mopidy/media
[m3u]
playlists_dir = /var/lib/mopidy/playlists
[audio]
output = alsasink
[spotify]
username = <Spotify Username>
password = <Spotify Password>
client_id = <string returned by the mopidy authenticate webpage>
client_secret = <string returned by the mopidy authenticate webpage>
bitrate = 320
pi@raspberrypi:~ $ sudo service mopidy start
pi@raspberrypi:~ $ sudo service mopidy status
● mopidy.service - Mopidy music server
Loaded: loaded (/lib/systemd/system/mopidy.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2017-12-20 01:16:00 EST; 4min 35s ago
Process: 4827 ExecStartPre=/bin/chown mopidy:audio /var/cache/mopidy (code=exited, status=0/SUCCESS)
Process: 4824 ExecStartPre=/bin/mkdir -p /var/cache/mopidy (code=exited, status=0/SUCCESS)
Main PID: 4829 (mopidy)
CGroup: /system.slice/mopidy.service
└─4829 /usr/bin/python /usr/bin/mopidy --config /usr/share/mopidy/conf.d:/etc/mopidy/mopidy.conf
2017-12-20 01:16:02,419 INFO [4829:MainThread] mopidy.__main__: Starting Mopidy 2.1.0
2017-12-20 01:16:02,720 INFO [4829:MainThread] mopidy.config: Loading config from builtin defaults
2017-12-20 01:16:02,729 INFO [4829:MainThread] mopidy.config: Loading config from /etc/mopidy/mopidy.conf
2017-12-20 01:16:02,734 INFO [4829:MainThread] mopidy.config: Loading config from command line options
2017-12-20 01:16:02,911 INFO [4829:MainThread] mopidy.__main__: Enabled extensions: spotify, mpd, http, stream, m3u, softwaremixer, file
2017-12-20 01:16:02,914 INFO [4829:MainThread] mopidy.__main__: Disabled extensions: local
2017-12-20 01:16:03,633 INFO [4829:MainThread] mopidy.commands: Starting Mopidy mixer: SoftwareMixer
2017-12-20 01:16:03,641 INFO [4829:MainThread] mopidy.commands: Starting Mopidy audio
2017-12-20 01:16:03,649 INFO [4829:MainThread] mopidy.commands: Starting Mopidy backends: StreamBackend, M3UBackend, FileBackend, SpotifyBackend
2017-12-20 01:16:03,727 INFO [4829:Audio-2] mopidy.audio.actor: Audio output set to "alsasink"
2017-12-20 01:16:04,023 INFO [4829:MainThread] mopidy.commands: Starting Mopidy core
2017-12-20 01:16:04,227 INFO [4829:SpotifyEventLoop] spotify.session: Spotify logged in
2017-12-20 01:16:04,229 INFO [4829:SpotifyEventLoop] mopidy_spotify.backend: Logged in to Spotify in offline mode
2017-12-20 01:16:04,851 INFO [4829:SpotifyEventLoop] mopidy_spotify.backend: Logged in to Spotify in online mode
2017-12-20 01:16:24,453 INFO [4829:MainThread] mopidy.commands: Starting Mopidy frontends: MpdFrontend, HttpFrontend
2017-12-20 01:16:24,457 INFO [4829:MainThread] mopidy.mpd.actor: MPD server running at [::ffff:127.0.0.1]:6600
2017-12-20 01:16:24,466 INFO [4829:HttpFrontend-12] mopidy.http.actor: HTTP server running at [::ffff:127.0.0.1]:6680
2017-12-20 01:16:24,468 INFO [4829:MainThread] mopidy.commands: Starting GLib mainloop
2017-12-20 01:16:57,588 INFO [4829:MpdSession-13] mopidy.mpd.session: New MPD connection from [::ffff:127.0.0.1]:53580
...
Basically, the configurations are exactly the same except that the file folders point to different locations for the interactive version versus the service version.
So, why is there no sound? I have nothing in the Mopidy log and no errors from mpc to give any sort of clue.
Thanks in advance for your insights.