Everything is set up, but I hear nothing

Hi,

I was just about to buy some SONOS speakers when I found mopidy, which also gives new live to my collections of raspberry Pis, so I set everything up and after a bit I have now the

  • MOPIDYSERVER running
  • with IRIS
  • and MUSICBOX,
  • the SNAPSERVER
  • and CLIENT on the RPi as well,
  • I have SNAP.NET on my PC and on my mobilephone

Extension-wise I have

  • local configured and mounted my PCs musiclibrary on the pi and scanned all the songs
  • Soma FM
  • Last FM
  • and Youtube

I tested the sound-output on the RPi on the headphone jack and with a USB speaker.

However, I cannot produce any sound from anysource. No stream from my PC, nothng from Soma or last FM or from the local music.

When ever I click a song or radiostation nothing happens. The source shows up under “currently playing” in IRIS or MUSICBOX but the player progress bar shows nothing.

I checked the mopidy config but systemctl status mopidy show no errors.

I just checked the status of snapserver and snap client and I do get some errors. namely:

root@raspberrypi:/home/pi# systemctl status snapserver
● snapserver.service - Snapcast server
     Loaded: loaded (/lib/systemd/system/snapserver.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2022-10-10 02:34:21 CEST; 10s ago
       Docs: man:snapserver(1)
   Main PID: 23216 (snapserver)
      Tasks: 5 (limit: 779)
        CPU: 718ms
     CGroup: /system.slice/snapserver.service
             └─23216 /usr/bin/snapserver --logging.sink=system --server.datadir=/var/lib/snapserver

Oct 10 02:34:26 raspberrypi snapserver[23216]: ControlSessionHttp::on_read error: bad method
Oct 10 02:34:28 raspberrypi snapserver[23216]: ControlServer::NewConnection: 192.168.178.63
Oct 10 02:34:28 raspberrypi snapserver[23216]: Removing 1 inactive session(s), active sessions: 4
Oct 10 02:34:28 raspberrypi snapserver[23216]: ControlSessionHttp::on_read error: bad method
Oct 10 02:34:29 raspberrypi snapserver[23216]: ControlServer::NewConnection: 192.168.178.63
Oct 10 02:34:29 raspberrypi snapserver[23216]: Removing 1 inactive session(s), active sessions: 4
Oct 10 02:34:29 raspberrypi snapserver[23216]: ControlSessionHttp::on_read error: bad method
Oct 10 02:34:31 raspberrypi snapserver[23216]: ControlServer::NewConnection: 192.168.178.63
Oct 10 02:34:31 raspberrypi snapserver[23216]: Removing 1 inactive session(s), active sessions: 4
Oct 10 02:34:31 raspberrypi snapserver[23216]: ControlSessionHttp::on_read error: bad method
Oct 10 02:34:32 raspberrypi snapserver[23216]: ControlServer::NewConnection: 192.168.178.63
Oct 10 02:34:32 raspberrypi snapserver[23216]: Removing 1 inactive session(s), active sessions: 4
Oct 10 02:34:32 raspberrypi snapserver[23216]: ControlSessionHttp::on_read error: bad method

and

root@raspberrypi:/home/pi# systemctl status snapclient
● snapclient.service - Snapcast client
     Loaded: loaded (/lib/systemd/system/snapclient.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2022-10-10 02:34:15 CEST; 4min 44s ago
       Docs: man:snapclient(1)
   Main PID: 23200 (snapclient)
      Tasks: 1 (limit: 779)
        CPU: 3.117s
     CGroup: /system.slice/snapclient.service
             └─23200 /usr/bin/snapclient --logsink=system -h 192.168.178.63 -p 1780

Oct 10 02:39:20 raspberrypi snapclient[23200]: Error reading message header of length 0: Connection reset by peer
Oct 10 02:39:20 raspberrypi snapclient[23200]: Error in socket shutdown: Transport endpoint is not connected
Oct 10 02:39:20 raspberrypi snapclient[23200]: Failed to send hello request, error: Connection timed out
Oct 10 02:39:20 raspberrypi snapclient[23200]: Time sync request failed: Connection timed out
Oct 10 02:39:21 raspberrypi snapclient[23200]: Resolving host IP for: 192.168.178.63
Oct 10 02:39:21 raspberrypi snapclient[23200]: Connecting
Oct 10 02:39:21 raspberrypi snapclient[23200]: Connected to 192.168.178.63
Oct 10 02:39:21 raspberrypi snapclient[23200]: My MAC: "b8:27:eb:4f:08:8f", socket: 9
Oct 10 02:39:21 raspberrypi snapclient[23200]: Error reading message header of length 0: Connection reset by peer
Oct 10 02:39:21 raspberrypi snapclient[23200]: Error in socket shutdown: Transport endpoint is not connected
Oct 10 02:39:22 raspberrypi snapclient[23200]: Failed to send hello request, error: Connection timed out
Oct 10 02:39:22 raspberrypi snapclient[23200]: Time sync request failed: Connection timed out

Does anyone have any idea what this could cause or where I can look further?

Cheers
F.

Did you run through the stuff at the bottom of Raspberry Pi — Mopidy 3.3.0 documentation including the step where you make sure your user audio settings match your system audio settings? Is this raspbian? Desktop? Lite?

I’ll also say its not clear from your post how snap client and snapserver fit into this. But you need to get a minimal mopidy setup and working first (no snapcast) and then add that.

Hey, thanks for checking my issues out.

  • Yes, i can produce the sine wave sound and i can play individual files with aplay from command line.

  • The system is a RPi3 with raspian 64bit lite.

  • From the tutorials I saw all of them use snapcast to distribute mopidys music stream to the final output dives/ speakers.

  • The snapcast client is for outputting the music on the RPi itself. But im not fully understanding why there needs to be snapcast with all these extra UPnP/DLNA extra bits an pieces :slight_smile:

Im using this “system” here, because i can roughly understand the structure and how all the parts interact.


and the homeassistant description here: Multi-room audio with Snapcast, Mopidy, and Home Assistant - Home Assistant loos similar.

I also wanted to use snapcast as well because it connects to Homeassistant.

in the [audio] config there is this part:

[AUDIO]
mixer = software
mixer_volume =
output = audioresample ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S16LE ! filesink location=/tmp/snapfifo
buffer_time =

where i think the outputs gets redirected to snapcast.
I saw somewhere that the output can be directly played on the RPi. Can Mopidy on its own also redirect the music streams to other speakers in the network or how would you achieve this famed “multi-room audio”?

Thanks in advance & Cheers
F

That guide you linked confused me, do you have output = alsasink and output = audioresample going at the same time in mopidy.conf?
From what i understand you need in mopidy.conf an audio output solely to sort of what you posted

output = audioresample ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S16LE ! filesink location=/tmp/snapfifo

the snapserver.conf gets the pipe by
source = pipe:///tmp/snapfifo?name=mopidy

and then have snapclient output the whole thing on that machine or others. (by simply starting it)

But first get a simple mopidy to play something directly to raspi output, i would recommend that too.

I set the output back to

[audio]
output = alsasink

and i can clearly hear:

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

I have the feeling that it isnt the sound output. If i would just not hear anything, the player would still behave like its playing right? What im seeing is that nothing happens when i press play.
There is just a little notification on the bottom right saying “1 URIs added”, but still nothing happens.

Did you do this part?

Alright, I reinstalled everything fresh and went with a simpler tutorial. and now the player plays music locally on the pi.

as soon as I switch the output from alsasink to `output = audioresample ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S16LE ! wavenc ! filesink location=/tmp/snapfifo it stops working.

So snapcast seems to be the problem.

thats good, lets make the snapcast work then!
What took me some reading was the “tmp/snapfifo permission denied” error of snapserver. fixed by:
sudo echo "fs.protected_fifos = 0" | sudo tee /etc/sysctl.d/snapcast-unprotect-fifo.conf
other than that the above outlined steps should do it.
let us see erorr logs if you struggle.

Here we go:

pi@raspberrypi:~ $ sudo journalctl -u snapserver
-- Journal begins at Thu 2022-09-22 05:17:24 CEST, ends at Wed 2022-10-12 16:01:41 CEST. --
Oct 11 05:07:47 raspberrypi systemd[1]: Started Snapcast server.
Oct 11 05:07:47 raspberrypi snapserver[3387]: Version 0.26.0, revision e30a9f33
Oct 11 05:07:47 raspberrypi snapserver[3387]: Adding source: pipe:///tmp/snapfifo?name=default
Oct 11 05:07:47 raspberrypi snapserver[3387]: Settings file: "/var/lib/snapserver/server.json"
Oct 11 05:07:47 raspberrypi snapserver[3387]: Using HTTP host name: raspberrypi
Oct 11 05:07:47 raspberrypi snapserver[3387]: Adding service 'Snapcast'
Oct 11 05:07:47 raspberrypi snapserver[3387]: PcmStream: default, sampleFormat: 48000:16:2
Oct 11 05:07:47 raspberrypi snapserver[3387]: PipeStream mode: create
Oct 11 05:07:47 raspberrypi snapserver[3387]: Stream: {"fragment":"","host":"","path":"/tmp/snapfifo","query":{"chunk_ms":"20","codec":"flac","name":"defaul>
Oct 11 05:07:47 raspberrypi snapserver[3387]: Init - compression level: 2
Oct 11 05:07:47 raspberrypi snapserver[3387]: Exception: end of file
Oct 11 05:07:47 raspberrypi snapserver[3387]: Creating TCP acceptor for address: 0.0.0.0, port: 1705
Oct 11 05:07:47 raspberrypi snapserver[3387]: Creating HTTP acceptor for address: 0.0.0.0, port: 1780
Oct 11 05:07:47 raspberrypi snapserver[3387]: Creating stream acceptor for address: 0.0.0.0, port: 1704
Oct 11 05:07:47 raspberrypi snapserver[3387]: Number of threads: 4, hw threads: 4
Oct 11 05:07:48 raspberrypi snapserver[3387]: StreamServer::NewConnection: 192.168.178.20
Oct 11 05:07:48 raspberrypi snapserver[3387]: StreamServer::NewConnection: 192.168.178.20
Oct 11 05:07:48 raspberrypi snapserver[3387]: Hello from 88:d7:f6:df:a3:bb#2, host: SungodsPCv2, v0.26.0, ClientName: Snapclient, OS: Windows 8, Arch: amd64>
Oct 11 05:07:48 raspberrypi snapserver[3387]: Service 'Snapcast' successfully established.
Oct 11 05:07:48 raspberrypi snapserver[3387]: Hello from 88:d7:f6:df:a3:bb#3, host: SungodsPCv2, v0.26.0, ClientName: Snapclient, OS: Windows 8, Arch: amd64>
Oct 11 05:07:50 raspberrypi snapserver[3387]: ControlServer::NewConnection: 192.168.178.20
Oct 11 05:08:09 raspberrypi snapserver[3387]: Received signal 15: Terminated
Oct 11 05:08:09 raspberrypi systemd[1]: Stopping Snapcast server...
Oct 11 05:08:09 raspberrypi snapserver[3387]: Stopping streamServer
Oct 11 05:08:09 raspberrypi snapserver[3387]: Removing 1 inactive session(s), active sessions: 1
Oct 11 05:08:09 raspberrypi snapserver[3387]: done
Oct 11 05:08:09 raspberrypi snapserver[3387]: Snapserver terminated.
Oct 11 05:08:09 raspberrypi systemd[1]: snapserver.service: Succeeded.
Oct 11 05:08:09 raspberrypi systemd[1]: Stopped Snapcast server.
Oct 11 05:08:09 raspberrypi systemd[1]: Started Snapcast server.
Oct 11 05:08:09 raspberrypi snapserver[3576]: Version 0.26.0, revision e30a9f33
Oct 11 05:08:09 raspberrypi snapserver[3576]: Adding source: pipe:///tmp/snapfifo?name=default
Oct 11 05:08:09 raspberrypi snapserver[3576]: Settings file: "/var/lib/snapserver/server.json"
Oct 11 05:08:09 raspberrypi snapserver[3576]: Using HTTP host name: raspberrypi
Oct 11 05:08:09 raspberrypi snapserver[3576]: Adding service 'Snapcast'
Oct 11 05:08:09 raspberrypi snapserver[3576]: PcmStream: default, sampleFormat: 48000:16:2
Oct 11 05:08:09 raspberrypi snapserver[3576]: PipeStream mode: create
Oct 11 05:08:09 raspberrypi snapserver[3576]: Stream: {"fragment":"","host":"","path":"/tmp/snapfifo","query":{"chunk_ms":"20","codec":"flac","name":"defaul>
Oct 11 05:08:09 raspberrypi snapserver[3576]: Init - compression level: 2
Oct 11 05:08:09 raspberrypi snapserver[3576]: Exception: end of file
Oct 11 05:08:09 raspberrypi snapserver[3576]: Creating TCP acceptor for address: 0.0.0.0, port: 1705
Oct 11 05:08:09 raspberrypi snapserver[3576]: Creating HTTP acceptor for address: 0.0.0.0, port: 1780
Oct 11 05:08:09 raspberrypi snapserver[3576]: Creating stream acceptor for address: 0.0.0.0, port: 1704
Oct 11 05:08:09 raspberrypi snapserver[3576]: Number of threads: 4, hw threads: 4
Oct 11 05:08:10 raspberrypi snapserver[3576]: StreamServer::NewConnection: 192.168.178.20
Oct 11 05:08:10 raspberrypi snapserver[3576]: Hello from 88:d7:f6:df:a3:bb#3, host: SungodsPCv2, v0.26.0, ClientName: Snapclient, OS: Windows 8, Arch: amd64>
Oct 11 05:08:10 raspberrypi snapserver[3576]: StreamServer::NewConnection: 192.168.178.20
Oct 11 05:08:10 raspberrypi snapserver[3576]: Hello from 88:d7:f6:df:a3:bb#2, host: SungodsPCv2, v0.26.0, ClientName: Snapclient, OS: Windows 8, Arch: amd64>
Oct 11 05:08:10 raspberrypi snapserver[3576]: Service 'Snapcast' successfully established.
Oct 11 05:08:19 raspberrypi snapserver[3576]: ControlServer::NewConnection: 192.168.178.20
Oct 11 05:09:39 raspberrypi snapserver[3576]: StreamServer::NewConnection: 192.168.178.67
Oct 11 05:09:40 raspberrypi snapserver[3576]: Hello from b8:27:eb:4f:08:8f, host: raspberrypi, v0.26.0, ClientName: Snapclient, OS: Debian GNU/Linux 11 (bul>
Oct 11 05:09:40 raspberrypi snapserver[3576]: Removing 1 inactive session(s), active sessions: 1
Oct 11 05:09:48 raspberrypi snapserver[3576]: Error reading message header of length 0: End of file
Oct 11 05:09:48 raspberrypi snapserver[3576]: onDisconnect: b8:27:eb:4f:08:8f
Oct 11 05:09:48 raspberrypi snapserver[3576]: StreamServer::NewConnection: 192.168.178.67
Oct 11 05:09:48 raspberrypi snapserver[3576]: Hello from b8:27:eb:4f:08:8f, host: raspberrypi, v0.26.0, ClientName: Snapclient, OS: Debian GNU/Linux 11 (bul>
Oct 11 05:18:42 raspberrypi snapserver[3576]: ControlServer::NewConnection: 192.168.178.20

so ill tried a bit more. tried to make hydraplay work which is an all in one solution for mopidy and snapcast. but that had its own issues.

i tried it with ubuntu instead of rasbian, which also didnt work.

is there any way i can test if snapserver receives the stream correctly?
if i can play music locally via mopidy then something must not be working right on the snapserver side right?