Raspberri PI & Output to Sonos


hi

I am new to raspberry PI. I have a sub and 3 play 1’s and plan to ad the ARC at some stage. I want better sound quality than streaming off the phone or PC so I was planning on some changes.

I like the rasperry pi so I was wanting to guy a PI hat audio streamer and play all my music through it to my sonos speakers. I was thinking of using roon too.

I also have a Synology NAS and I want to stream from that too.

Is there a way to make this happen?? I cant seem to work it out.

 

Thx in advance.


This topic has been closed for further comments. You can use the search bar to find a similar topic, or create a new one by clicking Create Topic at the top of the page.

19 replies

Userlevel 7
Badge +21

Easiest way is to get a Sonos device with a Line in.  That would be a Five, Port or Amp.  Then just hook up the Audio out from the Pi into the Line in.  The line in source can then be played on any speaker of  combination of speakers or all speakers at once.

 

Also you could use the Pi itself.

See this thread 

 

Easiest way is to get a Sonos device with a Line in.  That would be a Five, Port or Amp.  Then just hook up the Audio out from the Pi into the Line in.  The line in source can then be played on any speaker of  combination of speakers or all speakers at once.


thanks very much. Will this make my audio experience a lot better?? I was thinking of using this. I want it to run on wifi

https://thepihut.com/products/allo-boss-raspberry-pi-master-dac-v1-2

 

I couldnt find any you tube info on it.

Will I be able to add roon and all he usual music streamers also? Deezer Spotify tidal etc?

 

Userlevel 7
Badge +18

Hi @mmggffee 

I’m not sure I understand the point to your endeavour - other than getting Roon to play on Sonos. If that’s all you’re trying to do, fair enough.

Any output from the Hat is going to have to be analogue - this gets converted into digital inside a Sonos unit (ADC) so it can be shared on the network and then back to analogue for reproduction (DAC). Although you will be able to do additional signal processing on the Pi, the multiple conversions mean that you’d likely get (technically, but possibly not noticeably) better sound by just sending the original stream straight to Sonos. Certainly having a superior DAC isn’t going to improve fidelity after this double-conversion step (I’m not saying that DAC is superior, I’m not saying it’s not - I’m saying it won’t help if it is) and having an inferior DAC at that stage will degrade the audio quality.

I can’t help as to what you can add to Pi.

No need for analog output from your Pi to Sonos.  Install a distro such as piCorePlayer, enable LMS, and install the DLNA/UPnP plugin.  Your Sonos units will all show up as WiFi endpoints, to which you can steam directly from your NAS, Qobuz, Tidal, Spotify, Youtube, etc, using the associated plugins.

Also, a package like Pulseaudio-dlna will allow sending any audio played on your Pi to your Sonos speakers.

Userlevel 7
Badge +22

If you want to use the Sonos Music Library you need SMBv1 available. I’m not a fan of having that on my main NAS due to security issues but it is simple to add a NAS to SMBv1 gateway on your Pi or just put the music there instead of the NAS.  

https://stan-miller.livejournal.com/

If I was feeding audio to Sonos I’d look at digital solutions instead of digital-analog-digital ones that add conversion issues. I’m not an expert there but these look interesting.

https://smile.amazon.com/s?k=HiFiBerry&ref=bl_dp_s_web_0

Thx for replies so far. I’m trying to improve the signal so better sound quality also. 

Thx for replies so far. I’m trying to improve the signal so better sound quality also. 

That’s not going to happen. 

Userlevel 7
Badge +22

Thx for replies so far. I’m trying to improve the signal so better sound quality also. 

As was said above, getting away from the analog audio output of the Pi is the way to go. It isn’t high quality, and it is a bit noisy from all the nearby circuits on the Pi. You can never improve it with add-ons but you can make things worse by stacking multiple conversions, every one hurts fidelity.

I don't know how relevant this is or if it helps - I have a USB stick containing lossless CD rips plugged into a PI that streams these via WiFi to a Echo dot device via the my media for Alexa app. 

With the Echo plugged to Sonos line in, I get the same sound quality as from my regular NAS.

PS: if one splurges a little more for a Echo Show 5, album art also available.

Userlevel 7
Badge +18

Personally, I have a Pi running Plex Media Server and have both Sonos & Alexa signed into Plex - I can ask Alexa to play FLAC audio from my own library through Sonos.

If I had any 24bit audio, I would be able to play it. Getting a FLAC or ALAC 24bit file directly to a Sonos player in it’s digital form is the best music sound quality you’ll get from Sonos speakers.

From what I hear of Poon, it has more features for audio than Plex, but it can’t be added to Sonos.

I feel the best advice was from @chicks above:

No need for analog output from your Pi to Sonos.  Install a distro such as piCorePlayer, enable LMS, and install the DLNA/UPnP plugin.  Your Sonos units will all show up as WiFi endpoints, to which you can steam directly from your NAS, Qobuz, Tidal, Spotify, Youtube, etc, using the associated plugins.

Also, a package like Pulseaudio-dlna will allow sending any audio played on your Pi to your Sonos speakers.

 

Personally, I have a Pi running Plex Media Server and have both Sonos & Alexa signed into Plex - I can ask Alexa to play FLAC audio from my own library through Sonos.

 

 

This needs the Sonos Alexa integration to be available, correct?

And where does your local library sit?

Userlevel 7
Badge +18

Hi @Kumar 

Personally, I have a Pi running Plex Media Server and have both Sonos & Alexa signed into Plex - I can ask Alexa to play FLAC audio from my own library through Sonos.

This needs the Sonos Alexa integration to be available, correct?

Yes - I can ask a Sonos One “Alexa, Ask Plex to play Nirvana” (other ways of asking don’t seem to work, unlike Spotify where you can say “Play Nirvana from Spotify”).

The Sonos One has Alexa, Sonos has the Plex service, and Alexa has the Sonos and Plex skills. The Pi knows nothing of Alexa or Sonos.

I should mention that this is unsupported - it works, usually, but you’re kind of on your own. I would help as much as I am able, of course - I just mean if you contact tech support they won’t know much about it.

And where does your local library sit?

Ah. It appears I over-simplified. I used to have Plex Media Server on the Pi, but now it is on my nVidia Shield Pro (for on-the-fly video conversions). But the drives with the music/movies/TV are all ext4 volumes plugged into the Pi still, with SMB (v1, of course) sharing to the network at large.

Occasionally, Plex needs reauthorisation on Sonos (I think after Plex updates, but haven’t really confirmed this) and won’t play. When this happens, I revert to Sonos Music Library (using the app, not Alexa) which addresses the same SMB share until I can be bothered fixing Plex .

 

Although Alexa has a skill for the Shield, this doesn’t do much (similar to the Alexa power control that the Beam/Arc can add to your TV). It doesn’t relate to Plex and this all worked with the Plex server running on the Pi before I ever got the Shield.

awesome stuff thanks. I was also wanting to try roon and see how this works. The other issue I have is that my place isnt huge so i want to keep the footprint of things to the smaller scale. This was another reason for Pi integration. On a side note wanted to try PI as a private VPN and PI-HOLE too

Userlevel 7
Badge +18

I nearly mentioned my pi-hole, but thought it crude :joy:

I personally recommend keeping a separate Pi device just for pi-hole - if you need to reinstall/reconfigure software and reboot, it will get in the way of DNS working on your network for other devices. Less software also makes pi-hole quicker and the Pi more stable. In addition, less than a fortnight ago, James and myself both updated pi-hole and it broke both our Linux installs - no more boot. It was easier for me to fix than it was for James just for this reason - I had nothing but Linux and pi-hole to reinstall. There’s no need to get a RPI4 for this task - a slower device will do.

Yes - the Pi makes for a great server as long as you’re not after performance. If you’re not a Linux expert, I recommend you look into Webmin - this allows you to configure Linux via a webpage - makes it easier to set up SMB, drives mounted at boot (I needed to do this when transmission-daemon was loading before USB drive autodetection), drive partitioning, and many other things.

 

Edit: changed “easy” to “easier”.

Userlevel 7
Badge +22

A Pi Zero W works great for Pi-Hole, just get a good 16 GB SD card and a quality power supply and it will run with no issues. If you want a wired connection a used Pi 3 is a good option.

Getting a second card and using the Pi’s built in card backup tool really reduces the risks of tweaking and updates.

I don’t put other things on my Pi-Hole Pi. Other folks seem to think the VPN option is a good fit and there is a good bit of discussion in the Pi-Hole forums on that. The NAS to SMBv1 gateway would also be a good fit.

Userlevel 7
Badge +20

If you like tinkering at the command line and want to control Sonos from your Pi, SoCo-CLI allows you to play local audio files to any Sonos speaker:

https://github.com/avantrec/soco-cli#audio-files-on-the-local-filesystem

As for Pi-Hole, personally I run this in a Docker container. Easy to update, and easy to isolate from anything else running on the Pi:

https://hub.docker.com/r/pihole/pihole

Userlevel 7
Badge +22

For controlling my Sonos from the Pi I use this:

http://pascalopitz.github.io/unoffical-sonos-controller-for-linux/

The armv7l.AppImage one works great, download, set to executable and click it.

For controlling my Sonos from the Pi I use this:

http://pascalopitz.github.io/unoffical-sonos-controller-for-linux/

The armv7l.AppImage one works great, download, set to executable and click it.

Yeah, the .deb version works on Chromebooks, too (with Linux enabled and ports open).  I’m not a fan of the UI, especially compared to the LMS Material Skin (or Jivelite on a Pi Zero WH with a nice touchscreen).

Userlevel 7
Badge +18

For anyone running Pi-Hole, I recommend following the steps on this video: 

 

This adds “unbound” to your configuration and Pi-Hole no longer uses upstream DNS servers - it resolves requests itself and caches the result locally.