Stream from Mopidy to Mopidy

I came across the ‘Pirate Audio’ hat from Pimoroni and thought that would make a good ‘Sonos’ alternative. I’m new to the realm of Raspberry Pi so not that knowledge about the programming. I have followed many different guides to install and configure Mopidy, and currently have 2 Pi Zero W’s configured with spotify. The issue i’m having is syncing the music. I have tried to install and understand Icecast & SnapCast but i’m not getting anywhere with it. The Mopidy web interface has the services as options but cannot understand what i’m not doing correctly.

The ultimate goal is ideally having 1 web interface by using 1 of the Pi’s, that can output to both at the same time.

Any help would be grateful.

Which web interface are you using?

I’m using the Iris web interface

Is snapcast showing up in the interface?
and you’ve got the correct entry in your mopidy conf file?

Snapcast is showing in the interface under settings

Here is a printout of the config

[core]
cache_dir = /var/cache/mopidy
config_dir = /etc/mopidy
data_dir = /var/lib/mopidy
max_tracklist_length = 10000
restore_state = false

[logging]
verbosity = 0
format = %(levelname)-8s [%(threadName)s] %(name)s %(message)s
color = false
config_file =

[audio]
mixer = software
mixer_volume = 40
output = alsasink device=hw:sndrpihifiberry
buffer_time =

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

[raspberry-gpio]
enabled = true
bcm0 =
bcm1 =
bcm2 =
bcm3 =
bcm4 =
bcm5 = play_pause,active_low,250,
bcm6 = volume_down,active_low,250,
bcm7 =
bcm8 =
bcm9 =
bcm10 =
bcm11 =
bcm12 =
bcm13 =
bcm14 =
bcm15 =
bcm16 = next,active_low,250,
bcm17 =
bcm18 =
bcm19 =
bcm20 = volume_up,active_low,250,
bcm21 =
bcm22 =
bcm23 =
bcm24 = volume_up,active_low,250,
bcm25 =
bcm26 =
bcm27 =

[pidi]
enabled = true
display = st7789
rotation = 90

[iris]
enabled = true
country = GB
locale = en_GB
spotify_authorization_url =
lastfm_authorization_url =
genius_authorization_url =
data_dir = $XDG_DATA_DIR/iris

[file]
enabled = true
media_dirs =
/home/pi/Music
excluded_file_extensions =
.directory
.html
.jpeg
.jpg
.log
.nfo
.pdf
.png
.txt
.zip
show_dotfiles = false
follow_symlinks = false
metadata_timeout = 1000

[http]
enabled = true
hostname = 0.0.0.0
port = 6680
zeroconf = Mopidy HTTP server on $hostname
allowed_origins =
csrf_protection = true
default_app = mopidy

[m3u]
enabled = true
base_dir =
default_encoding = latin-1
default_extension = .m3u8
playlists_dir =

[softwaremixer]
enabled = true

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

[spotify]
enabled = true
username = ********
password = ********
client_id = ********
client_secret = ********
bitrate = 160
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 =

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

Just set it up on 2 Pi3’s so will be much the same. Using buster on both.
Depending on what you want to do with mopidy, I set up Mopidy, Iris, Snapserver and Snapclient on Pi1, on Pi2 I set up just Snapclient.
On Pi1, in the Mopidy conf (sudo nano /etc/mopidy/mopidy.conf) you need to change the audio settings to;
[audio]
#mixer = software
#mixer_volume =
#output = autoaudiosink
#buffer_time =
#output = autoaudiosink
output = audioresample ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S16LE ! filesink location=/tmp/snapfifo

Launched Mopidy and Iris, both instances of Snapclient showed up and played through straight away.
I’m using a speaker through the earphone socket on Pi1 and using the HDMI socket to play through TV on Pi2.

If you have Mopidy setup on Pi2, you need to make sure it let’s go of the soundcard before trying to use Snapcast. You might be best to stop mopidy (sudo systemctl stop mopidy)
Hope this helps.

1 Like

Thanks Steve

I have spent the day playing with both pi’s. I have managed to get the snapcast to connect to the server (pi A connecting to pi B). I can only seem to alter the volume 1 of the pi’s, no other controls. The pi’s are connected to the same spotify account but cannot stream the same music at the same time.

I will keep playing with the setup. Any other ideas would help.

Do you have mopidy installed on both Pi’s, you shouldn’t need to have spotify on both, just on pi A

Actually, try turning off PiB.
On PiA Install Mopidy and it’s Spotify bit, along with Iris.
Install Snapserver and SnapClient as above and make necessary changes to the Mopidy.conf file.
If you get it running on PiA you’ll find it easy to set up PiB.
Also make sure and read up on the SnapCast site how the setup should work.

I’ve rebuilt both Pi’s and I can now play spotify from Pi A to Pi B with volume control, however I am not getting any audio out of Pi A.

Have you installed Snapclient as well as Snapserver on Pi A?
Can you see Pi A in the Iris control panel?
What response do you get from “sudo systemctl status snapclient”

From the docs;“When you are using a Raspberry Pi, you might have to change your audio output to the 3.5mm jack”

Could you get sound from Pi A before you installed Snapcast and changed the mopidy.conf file to # out the unwanted lines?

There is a good audio set up guide here

Strange one this. I left the Pi’s off over night and have just looked at them again and everything is working as it should. Both Pi’s are playing at the same time.

Many thanks for your input Steve.