No sound from spotify

Thanks to Nick I have managed to get mopidy to work with spotify… but I have no sound ! My installation is a raspberry pi which had an existing mpd server. The pi has a sound card wired on top of it. I think there may be a problem between my old mpd installation and mopidy. I would like to tell mopidy to use the conf in mpd.conf, especially the part telling

audio_output {
    type            "alsa"
    name            "My ALSA Device"
    device          "hw:0,0"        # optional
    mixer_type      "software"      # optional
    mixer_device    "default"       # optional
    mixer_control   "Master"                # optional
  #       mixer_index     "0"             # optional
}

I tried to install mopidy-alsamixer but it didn’t worked. Is it the way to look at ? Or should I completely remove my previous mpd installation ?

Mpd and Mopidy are entirely separate programs. They can coexist if you are sure to configure each of them to use different ports. But an mpd configuration has absolutely nothing to do with Mopidy.

If you are not using the raspberry pi analogue output then best plan is to simply disable it in your /boot/config.txt. Theneverything will use the soundcard instead by default. I.e it will just work.

oh big misunderstanding from me, I had understood that mopidy used mpd to stream. My mpd is on 6600 and mopidy on 6680 therefore there shouldn’t be problem. I tried to disable the analogue output but I think it’s already done, here is what I have in config.txt :

# Enable audio (loads snd_bcm2835)
#dtparam=audio=on
dtoverlay=hifiberry-dac
dtoverlay=i2s-mmap

or I am mistaken ?

To understand better, what is the use of the mpd param in mopidy.conf since mpd is independant from mopidy ?

thanks again for your time,

Mopidy includes multiple optional “Frontends” (interfaces):

  • An MPD interface on the port configured in the mpd section of your Mopidy config file. The default is 6600. If this interface is enabled and you are running both Mopidy and mpd, you must change the port to something else. Otherwise, whichever program starts first will take port 6600 and the second program will not be able to use it.
  • A HTTP interface on the port configured in the http section of your Mopidy config file. The default is 6680.

The mpd section of your Mopidy config file is used to configure Mopidy’s MPD interface.

There’s not normally a reason to run both Mopidy and mpd but it explains your other thread where you were unable to search Spotify using your MPD client. You were sending your search query to mpd, not Mopidy.

That should work as the default value is off. Personally I’d have the following instead and it’s clearer what you want.

dtparam=audio=off

If you run aplay -l on your Raspberry Pi you should only see the hifiberry-dac listed and all audio should come through that.

when I type aplay -l I got only one device, so the problem probably don’t come frome here. I have looked more thoroughly at my web clients (iris and mopify) : I can browse spotify, I can see my playlists, but the “play” function doesn’t seem to work : when I right clic/play on iris, nothing happen, and if I clic on the |> button, no noise, but the song timer start, for four seconds, then restart at zero, and so on. On mopify, I can see playlists (mine or featured playlists) but I can’t see the song into. When I click on play on a playlist, nothing happen.

Check your Mopidy logs to see if there any errors reported.

You could try an internet radio stream or a local file to see if your problem is only related to Spotify audio or Mopidy audio in general.

You can also try https://docs.mopidy.com/en/latest/installation/raspberrypi/#testing-sound-output
and also run:

gst-launch-1.0 audiotestsrc ! audioresample ! autoaudiosink

And just to check, you do understand that the audio will not play through the browser, right? It will play through the speaker you have connected to the hifiberry-dac.

  • no problem on this side of system understanding :). What I do want is to play music on the speakers connected to my raspberry pi.

  • I tried to launch mopidy with -v, and I got an error when I try to play :

    WARNING 2019-07-03 16:28:31,066 [12970:Audio-2] mopidy.audio.actor
    Setting GStreamer state to GST_STATE_PLAYING failed
    ERROR 2019-07-03 16:28:31,068 [12970:MainThread] mopidy.audio.gst
    GStreamer error: gst-resource-error-quark: Could not open audio device for playback. (6)
    WARNING 2019-07-03 16:28:31,071 [12970:Core-10] mopidy.core.tracklist
    Track is not playable: spotify:track:773xZHHSHJvC1z3AAtWgH6

when I try to test sound, I get :

aplay /usr/share/sounds/alsa/Front_Center.wav
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Access denied

(same result with sudo)

and when I try

gst-launch-1.0 audiotestsrc ! audioresample ! autoaudiosink

I get

Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
WARNING: from element /GstPipeline:pipeline0/GstAutoAudioSink:autoaudiosink0: Failed to connect: Access denied
Additional debug info:
pulsesink.c(615): gst_pulseringbuffer_open_device (): /GstPulseSink:autoaudiosink0-actual-sink-pulse
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock

and nothing more.

I know the sound system is working because with my previous mpd install, I can have music. But not from mopidy for now.

I thought we were dealing with a normal Raspbian installation? Normal Raspbian doesn’t have Pulseaudio installed.

https://docs.mopidy.com/en/latest/service/?highlight=pulse#configure-pulseaudio

I’m sorry I don’t remember installing pulseaudio, I thought I used only Alsa from my previous installation. Do you think it would be simpler to just get rid of pulseaudio ? Why could I have need it ? I will try making it work anyway.

It’s possible it comes installed on the latest Raspbian, I’ve got a vague memory that it might be needed for Bluetooth support these days. But it never used to be required and it does add a bit of complexity. But if you follow the link you should be able to get it to work with Pulse. I would personally uninstall it if you don’t think you need it.

I uninstalled pulseaudio, it now works !! I had to retune my mpd.conf because it wasn’t working anymore (strange, my output was alsa anyway, but when I comment the

#       device          "hw:0,0"        # optional

line it was happy again. I still have some tweaking to try to unify everything in mopidy, but anyway thanks a lot for your help and patience.

Oh great. Are you using raspbian desktop or raspbian lite?

raspbian lite I think (it’s a headless pi, I connect to it via ssh, hence it’s probably that though I am not sure, it has been a long time since I set it up first)